Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearchitect exporter to use BullMQ as a background job queueing system #5

Merged
merged 35 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
158e781
Rearchitect exporter to background exporting tasks.
NoahSaso Sep 30, 2023
5c22672
Added password auth to bull dashboard.
NoahSaso Sep 30, 2023
9f2474c
Fixed missing types.
NoahSaso Sep 30, 2023
5c50b56
Pass config from server.
NoahSaso Sep 30, 2023
fb4cd49
Load bull board in function so config loads.
NoahSaso Sep 30, 2023
024242f
Fixed bull connection getter.
NoahSaso Sep 30, 2023
1bc2e3c
Fixed bull board route.
NoahSaso Sep 30, 2023
63668fb
Attempt fix bull board router.
NoahSaso Oct 1, 2023
4371ca5
Attempt fix bull board router 2.
NoahSaso Oct 1, 2023
9e4821b
Attempt fix bull board router 3.
NoahSaso Oct 1, 2023
f7414dd
Attempt fix bull board router 4.
NoahSaso Oct 1, 2023
1a1f418
Attempt fix bull board router 5.
NoahSaso Oct 1, 2023
69c00d0
Attempt fix bull board router 6.
NoahSaso Oct 1, 2023
7566f05
Installed missing package.
NoahSaso Oct 1, 2023
bd9dc48
Attempt fix bull board router 7.
NoahSaso Oct 1, 2023
a5c2429
Change to /jobs.
NoahSaso Oct 1, 2023
0336b23
Reordered core exports.
NoahSaso Oct 1, 2023
7afac40
Load DB and close at the end.
NoahSaso Oct 1, 2023
edcac5c
Improved log.
NoahSaso Oct 1, 2023
d7f545a
Exit process manually at end.
NoahSaso Oct 1, 2023
28a3e2e
Validate ID uniqueness and remove once queued.
NoahSaso Oct 1, 2023
8fbc3bd
Auto remove jobs after 1 or 3 days depending on their status.
NoahSaso Oct 1, 2023
4116aa7
Fix fifo read stream not resolving once closed.
NoahSaso Oct 1, 2023
0eb9270
Fixed log.
NoahSaso Oct 1, 2023
6664169
Improved log.
NoahSaso Oct 1, 2023
2da858b
Added block log.
NoahSaso Oct 1, 2023
038941e
Added buffer to wait for block height if WebSocket connected but not …
NoahSaso Oct 1, 2023
ee14bb9
Added cache to prevent waiting for the same block more than once.
NoahSaso Oct 1, 2023
44beb41
Allow capturing any block height error because we should not surpass …
NoahSaso Oct 1, 2023
c778cb1
Capture failed workers errors, keep all failed jobs, and auto retry f…
NoahSaso Oct 1, 2023
e1c5495
Capture error on export queue.
NoahSaso Oct 1, 2023
d238d69
Converted pending webhooks model into worker job queue.
NoahSaso Oct 1, 2023
e09589a
Added all queues to bull dashboard.
NoahSaso Oct 1, 2023
344b060
Wait up to 5 seconds for the block time to load and no need to preven…
NoahSaso Oct 2, 2023
704ca84
Added redis container to docker compose to fix tests.
NoahSaso Oct 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ services:
NODE_ENV: development
# contains db connection info that matches db service setup below
CONFIG_FILE: config-dev.json
# waits for db to start
# waits for db and redis to start
depends_on:
db_accounts:
condition: service_healthy
db_data:
condition: service_healthy
redis:
condition: service_healthy
# colorizes output
tty: true

Expand Down Expand Up @@ -47,5 +49,13 @@ services:
timeout: 3s
retries: 5

redis:
image: redis:7-alpine
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]
interval: 1s
timeout: 3s
retries: 5

volumes:
node_modules:
12 changes: 11 additions & 1 deletion compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ services:
NODE_ENV: test
# contains db connection info that matches db service setup below
CONFIG_FILE: config-test.json
# waits for db to start
# waits for db and redis to start
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
# colorizes output
tty: true

Expand All @@ -32,5 +34,13 @@ services:
timeout: 3s
retries: 5

redis:
image: redis:7-alpine
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]
interval: 1s
timeout: 3s
retries: 5

volumes:
node_modules:
3 changes: 3 additions & 0 deletions config-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"home": "./fake",
"rpc": "https://uni-rpc.reece.sh",
"bech32Prefix": "juno",
"redis": {
"host": "redis"
},
"db": {
"data": {
"dialect": "postgres",
Expand Down
3 changes: 3 additions & 0 deletions config-test.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"redis": {
"host": "redis"
},
"db": {
"data": {
"dialect": "postgres",
Expand Down
4 changes: 4 additions & 0 deletions config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"home": "/Users/noah/.juno/indexer",
"rpc": "https://uni-rpc.reece.sh",
"bech32Prefix": "juno",
"redis": {
"host": "127.0.0.1",
"password": ""
},
"db": {
"data": {
"dialect": "postgres",
Expand Down
10 changes: 6 additions & 4 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
module.exports = {
apps: [
{
name: 'exporter',
script: 'dist/scripts/export/index.js',
name: 'export-tracer',
script: 'dist/scripts/export/trace.js',
wait_ready: true,
listen_timeout: 30000,
kill_timeout: 30000,
},
{
name: 'webhooks',
script: 'dist/scripts/webhooks.js',
name: 'export-processor',
script: 'dist/scripts/export/process.js',
wait_ready: true,
listen_timeout: 30000,
kill_timeout: 30000,
},
{
Expand Down
Loading
Loading