Commit 56e4db0
committed
feat(files_trashbin): Refactor expire background job to support parallel run
- Follow-up of #51600
The original PR introduced the possibility to continue an `ExpireTrash` job by saving the offset. This was to prevent having to start over the whole user list when the job crashed or was killed.
But on big instances, one process is not enough to go through all the users in a timely manner. Supporting parallel run allows covering more ground faster.
This PR introduced this possibility. We are now storing the offset right away to allow another parallel job to pick up the task at that point. We are arbitrarily cutting the user list in chunk of 10 to not drastically overflow the 30 minutes time limit.
Signed-off-by: Louis Chemineau <louis@chmn.me>1 parent 4a1a8c7 commit 56e4db0
File tree
2 files changed
+45
-45
lines changed- apps/files_trashbin
- lib/BackgroundJob
- tests/BackgroundJob
2 files changed
+45
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | | - | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | | - | |
30 | | - | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 48 | + | |
47 | 49 | | |
48 | | - | |
49 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
50 | 59 | | |
51 | | - | |
52 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
53 | 71 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 72 | | |
59 | 73 | | |
60 | | - | |
| 74 | + | |
61 | 75 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 76 | + | |
| 77 | + | |
67 | 78 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 84 | + | |
| 85 | + | |
79 | 86 | | |
80 | 87 | | |
81 | | - | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
| |||
Lines changed: 11 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
23 | | - | |
24 | 23 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
39 | 31 | | |
40 | 32 | | |
41 | 33 | | |
| |||
45 | 37 | | |
46 | 38 | | |
47 | 39 | | |
| 40 | + | |
48 | 41 | | |
49 | 42 | | |
50 | 43 | | |
| |||
64 | 57 | | |
65 | 58 | | |
66 | 59 | | |
67 | | - | |
| 60 | + | |
68 | 61 | | |
69 | 62 | | |
70 | 63 | | |
| |||
75 | 68 | | |
76 | 69 | | |
77 | 70 | | |
78 | | - | |
| 71 | + | |
79 | 72 | | |
80 | 73 | | |
81 | 74 | | |
0 commit comments