diff --git a/lib/cron/fade-rate-v2.ts b/lib/cron/fade-rate-v2.ts index bfb0ca0..8a023c3 100644 --- a/lib/cron/fade-rate-v2.ts +++ b/lib/cron/fade-rate-v2.ts @@ -131,9 +131,13 @@ export function calculateNewTimestamps( const fades = row[1]; const fillerTimestamp = fillerTimestamps.get(hash); if (fillerTimestamp && fillerTimestamp.blockUntilTimestamp > newPostTimestamp) { - return; - } - if (fades) { + updatedTimestamps.push({ + hash, + lastPostTimestamp: newPostTimestamp, + blockUntilTimestamp: fillerTimestamp.blockUntilTimestamp, + consecutiveBlocks: fillerTimestamp.consecutiveBlocks, + }); + } else if (fades) { const blockUntilTimestamp = calculateBlockUntilTimestamp( newPostTimestamp, fillerTimestamp?.consecutiveBlocks, diff --git a/test/crons/fade-rate-v2.test.ts b/test/crons/fade-rate-v2.test.ts index e348539..930fce2 100644 --- a/test/crons/fade-rate-v2.test.ts +++ b/test/crons/fade-rate-v2.test.ts @@ -104,6 +104,19 @@ describe('FadeRateCron test', () => { blockUntilTimestamp: now + Math.floor(BASE_BLOCK_SECS * Math.pow(NUM_FADES_MULTIPLIER, 0)), consecutiveBlocks: 1, }, + // still update lastPostTimestamp when blockUntilTimestamp > now + { + hash: 'filler3', + lastPostTimestamp: now, + blockUntilTimestamp: now + 1000, + consecutiveBlocks: 0, + }, + { + hash: 'filler5', + lastPostTimestamp: now, + blockUntilTimestamp: now + 100, + consecutiveBlocks: 0, + }, // test exponential backoff { hash: 'filler7', @@ -138,12 +151,7 @@ describe('FadeRateCron test', () => { }); it('keep old blockUntilTimestamp if no new fades', () => { - expect(newTimestamps).not.toContain([['filler5', expect.anything(), expect.anything()]]); expect(newTimestamps).not.toContain([['filler4', expect.anything(), expect.anything()]]); }); - - it('ignores fillers with blockUntilTimestamp > current timestamp', () => { - expect(newTimestamps).not.toContain([['filler3', expect.anything(), expect.anything()]]); - }); }); });