Skip to content

Instantly share code, notes, and snippets.

@semaperepelitsa
Created July 11, 2019 21:48
Show Gist options
  • Save semaperepelitsa/aad43ae50c17d28bcca7a06ed125d4ca to your computer and use it in GitHub Desktop.
Save semaperepelitsa/aad43ae50c17d28bcca7a06ed125d4ca to your computer and use it in GitHub Desktop.
ActiveJob "exponentially_longer" wait times
select n, delay, sum(delay) over (order by n) total_delay from (
select n, make_interval(secs => (pow(n, 4) + 2)::int) delay from generate_series(1, 20) n
) _;
n delay total_delay
1 00:00:03 00:00:03
2 00:00:18 00:00:21
3 00:01:23 00:01:44
4 00:04:18 00:06:02
5 00:10:27 00:16:29
6 00:21:38 00:38:07
7 00:40:03 01:18:10
8 01:08:18 02:26:28
9 01:49:23 04:15:51
10 02:46:42 07:02:33
11 04:04:03 11:06:36
12 05:45:38 16:52:14
13 07:56:03 24:48:17
14 10:40:18 35:28:35
15 14:03:47 49:32:22
16 18:12:18 67:44:40
17 23:12:03 90:56:43
18 29:09:38 120:06:21
19 36:12:03 156:18:24
20 44:26:42 200:45:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment