From 3a488e39d53dc4849836fde064c8a38d8aef2183 Mon Sep 17 00:00:00 2001 From: Antoine Clausse Date: Thu, 27 Jun 2024 10:11:09 +0200 Subject: [PATCH] Add `waitForDb` in scripts/resync_subscriptions.js (#19154) GitOrigin-RevId: 608bce2654d2b6dbeb662ad0da8bb5c5ce3d68f3 --- services/web/scripts/recurly/resync_subscriptions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/web/scripts/recurly/resync_subscriptions.js b/services/web/scripts/recurly/resync_subscriptions.js index a69e194c30..29345fb65c 100644 --- a/services/web/scripts/recurly/resync_subscriptions.js +++ b/services/web/scripts/recurly/resync_subscriptions.js @@ -7,6 +7,8 @@ const { setTimeout } = require('node:timers/promises') // make sure all `allMismatchReasons` are displayed in the output const util = require('util') const pLimit = require('p-limit') +const { waitForDb } = require('../../app/src/infrastructure/mongodb') + util.inspect.defaultOptions.maxArrayLength = null const ScriptLogger = { @@ -144,6 +146,8 @@ const loopForSubscriptions = async skipInitial => { let retryCounter = 0 const run = async () => { + await waitForDb() + while (true) { try { await loopForSubscriptions(