-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move all user events to NATS. * Remove redlock usage. * Track loading progress in database. * Add admin view for imports.
- Loading branch information
Showing
29 changed files
with
593 additions
and
343 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE linked_account_import; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CREATE TABLE linked_account_import ( | ||
linked_account_id uuid PRIMARY KEY REFERENCES linked_account (id) ON DELETE CASCADE, | ||
started_at timestamp with time zone NOT NULL DEFAULT current_timestamp, | ||
completed_at timestamp with time zone, | ||
expected_count integer NOT NULL, | ||
expected_ids text[] NOT NULL, | ||
loaded_ids text[] NOT NULL DEFAULT array[]::text[] | ||
); | ||
|
||
CREATE INDEX linked_account_import_started_at_idx ON linked_account_import (started_at DESC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SELECT | ||
* | ||
FROM | ||
linked_account | ||
WHERE | ||
id = $1 | ||
FOR UPDATE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
SELECT | ||
linked_account_id, | ||
linked_account.source_site, | ||
started_at, | ||
completed_at, | ||
expected_count, | ||
cardinality(loaded_ids) loaded_count | ||
FROM | ||
linked_account_import | ||
JOIN linked_account ON linked_account.id = linked_account_import.linked_account_id | ||
ORDER BY | ||
started_at DESC | ||
LIMIT | ||
100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
UPDATE | ||
linked_account_import | ||
SET | ||
completed_at = current_timestamp | ||
WHERE | ||
linked_account_id = $1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
UPDATE | ||
linked_account_import | ||
SET | ||
loaded_ids = array_append(loaded_ids, $2) | ||
WHERE | ||
linked_account_id = $1 | ||
RETURNING | ||
expected_count, | ||
cardinality(loaded_ids) loaded_count; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
INSERT INTO | ||
linked_account_import (linked_account_id, expected_count, expected_ids) | ||
VALUES | ||
($1, $2, $3); |
Oops, something went wrong.