-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: abstract the stats syncer to support general-purpose synchr…
…onization workers
- Loading branch information
Showing
47 changed files
with
209 additions
and
1,211 deletions.
There are no files selected for viewing
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,11 @@ | ||
--- | ||
"@blobscan/rest-api-server": minor | ||
"@blobscan/syncers": minor | ||
--- | ||
|
||
Refactored the stats syncer package to support general-purpose synchronization workers/queues. | ||
|
||
Key changes include: | ||
|
||
• Renamed the package to syncers. | ||
• Exported each syncer directly, removing the StatsSyncer managing entity. |
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,30 @@ | ||
import { | ||
DailyStatsSyncer, | ||
OverallStatsSyncer, | ||
createRedisConnection, | ||
} from "@blobscan/syncers"; | ||
|
||
import { env } from "./env"; | ||
import { getNetworkDencunForkSlot } from "./utils"; | ||
|
||
export function setUpSyncers() { | ||
const connection = createRedisConnection(env.REDIS_URI); | ||
|
||
const dailyStatsSyncer = new DailyStatsSyncer({ | ||
cronPattern: env.STATS_SYNCER_DAILY_CRON_PATTERN, | ||
redisUriOrConnection: connection, | ||
}); | ||
|
||
const overallStatsSyncer = new OverallStatsSyncer({ | ||
cronPattern: env.STATS_SYNCER_OVERALL_CRON_PATTERN, | ||
redisUriOrConnection: connection, | ||
lowestSlot: | ||
env.DENCUN_FORK_SLOT ?? getNetworkDencunForkSlot(env.NETWORK_NAME), | ||
}); | ||
|
||
Promise.all([dailyStatsSyncer.start(), overallStatsSyncer.start()]); | ||
|
||
return () => { | ||
return dailyStatsSyncer.close().finally(() => overallStatsSyncer.close()); | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.