Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: exponential backoff factor 1.5 -> 1.2 #391

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions lib/cron/fade-rate-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type FillerFades = Record<string, number>;
export type FillerTimestamps = Map<string, Omit<TimestampRepoRow, 'hash'>>;

export const BASE_BLOCK_SECS = 60 * 15; // 15 minutes
export const NUM_FADES_MULTIPLIER = 1.5;
export const NUM_FADES_MULTIPLIER = 1.2;

const log = Logger.createLogger({
name: 'FadeRate',
Expand Down Expand Up @@ -214,19 +214,19 @@ export function getFillersNewFades(
/*
calculate the block until timestamp with exponential backoff
if a filler faded multiple times in between the last post timestamp and now,
we apply a 1.5 multiplier for each fade
we apply a 1.2 multiplier for each fade

examples:
- 1 fade, 0 consecutive blocks: 15 minutes
- 1 fade, 1 consecutive blocks: (1.5 ^ 0) * 15 * 2^1 = 30 minutes
- 1 fade, 2 consecutive blocks: (1.5 ^ 0) * 15 * 2^2 = 60 minutes
- 1 fade, 3 consecutive blocks: (1.5 ^ 0) * 15 * 2^3 = 120 minutes
- 2 fades, 0 consecutive blocks: (1.5 ^ 1) * 15 * 2^0 = 22 minutes
- 2 fades 1 consecutive blocks: (1.5 ^ 1) * 15 * 2^1 = 45 minutes
- 2 fades 2 consecutive blocks: (1.5 ^ 1) * 15 * 2^2 = 90 minute
- 3 fades 0 consecutive blocks: (1.5 ^ 2) * 15 * 2^0 = 33 minutes
- 3 fades 1 consecutive blocks: (1.5 ^ 2) * 15 * 2^1 = 67 minutes
- 3 fades 2 consecutive blocks: (1.5 ^ 2) * 15 * 2^2 = 135 minutes
- 1 fade, 1 consecutive blocks: (1.2 ^ 0) * 15 * 2^1 = 30 minutes
- 1 fade, 2 consecutive blocks: (1.2 ^ 0) * 15 * 2^2 = 60 minutes
- 1 fade, 3 consecutive blocks: (1.2 ^ 0) * 15 * 2^3 = 120 minutes
- 2 fades, 0 consecutive blocks: (1.2 ^ 1) * 15 * 2^0 = 18 minutes
- 2 fades 1 consecutive blocks: (1.2 ^ 1) * 15 * 2^1 = 36 minutes
- 2 fades 2 consecutive blocks: (1.2 ^ 1) * 15 * 2^2 = 72 minute
- 3 fades 0 consecutive blocks: (1.2 ^ 2) * 15 * 2^0 = 21 minutes
- 3 fades 1 consecutive blocks: (1.2 ^ 2) * 15 * 2^1 = 43 minutes
- 3 fades 2 consecutive blocks: (1.2 ^ 2) * 15 * 2^2 = 86 minutes
*/
export function calculateBlockUntilTimestamp(
newPostTimestamp: number,
Expand Down