Repository navigation
feat(services): start quota threshold notifier job at server boot (#1212) - #1483
Open
lienhoatienphung-svg wants to merge 1 commit into
Open
lienhoatienphung-svg wants to merge 1 commit into
lienhoatienphung-svg wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires and starts
createQuotaNotifierJobat server boot insrc/index.ts, persists sent quota threshold notifications in PostgreSQL (PgQuotaNotificationStore), and integrates the job into graceful shutdown so in-flight checks complete cleanly before database pools close.Closes #1212
Key Changes
src/config/env.ts,src/config/index.ts):QUOTA_NOTIFIER_ENABLED(defaulttrueoutsidetest),QUOTA_NOTIFIER_INTERVAL_MS(default300000), andQUOTA_DEFAULT_MONTHLY_LIMIT(default10000).src/services/quotaNotifier.ts):PgQuotaNotificationStorebacked byquota_notifications_sent(developer_id, period, threshold, sent_at)for idempotent cross-restart notification tracking.loadDeveloperQuotasFromDbto resolve developer monthly limits fromapi_keys,developers.plan_overrides, or activewebhookssubscriptions.QuotaNotifierJobwithbeginShutdown()andawaitIdle()to satisfyShutdownSubsystem.src/index.ts):quotaNotifierJob, registered it inshutdownSubsystems, started it instartServer()whenconfig.quotaNotifier.enabledis true, and stopped it incloseAllDataResources().Verification
npx jest src/services/quotaNotifier.test.ts(37/37 passed).Payout Wallet (Base Mainnet USDC)
0x3806cd592a508d1992Ed007C2F53de251C2E7452