diff --git a/src/analytics/segmentQueue.ts b/src/analytics/segmentQueue.ts index 31edfbe30..0c424ee21 100644 --- a/src/analytics/segmentQueue.ts +++ b/src/analytics/segmentQueue.ts @@ -6,7 +6,9 @@ import { sleep } from '../utils/utils'; import { redisConfig } from '../redis'; const analytics = getAnalytics(); -const sendSegmentEventQueue = new Bull('send-segment-event', redisConfig); +const sendSegmentEventQueue = new Bull('send-segment-event', { + redis: redisConfig, +}); const numberOfVerifyDonationConcurrentJob = 1; diff --git a/src/services/syncDonationsWithNetwork.ts b/src/services/syncDonationsWithNetwork.ts index b493ef1e9..97918dfb7 100644 --- a/src/services/syncDonationsWithNetwork.ts +++ b/src/services/syncDonationsWithNetwork.ts @@ -9,7 +9,16 @@ import Bull from 'bull'; import config from '../config'; import { redisConfig } from '../redis'; -const verifyDonationsQueue = new Bull('verify-donations-queue', redisConfig); +const verifyDonationsQueue = new Bull('verify-donations-queue', { + redis: redisConfig, +}); +const TWO_MINUTES = 1000 * 60 * 2; +setInterval(async () => { + const verifyDonationsQueueCount = await verifyDonationsQueue.count(); + console.log(`Verify donations job queues count:`, { + verifyDonationsQueueCount, + }); +}, TWO_MINUTES); // As etherscan free plan support 5 request per second I think it's better the concurrent jobs should not be // more than 5 with free plan https://etherscan.io/apis @@ -38,10 +47,9 @@ const addJobToCheckPendingDonationsWithNetwork = async () => { }, select: ['id'], }); - if (donations.length === 0) { - console.log('There is no pending donation to check with network'); - } + console.log('Pending donations to be check', donations.length); donations.forEach(donation => { + console.log('Add pending donation to queue', { donationId: donation.id }); verifyDonationsQueue.add({ donationId: donation.id, }); @@ -49,6 +57,7 @@ const addJobToCheckPendingDonationsWithNetwork = async () => { }; function processVerifyDonationsJobs() { + console.log('processVerifyDonationsJobs() has been called'); verifyDonationsQueue.process( numberOfVerifyDonationConcurrentJob, async (job, done) => {