Skip to content

Commit 9db035a

Browse files
fix: backup failure overlap issue (#1514)
1 parent 273db36 commit 9db035a

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

app/Jobs/DataBackupJob.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ class DataBackupJob implements ShouldQueue
1717
{
1818
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
1919

20+
/**
21+
* Number of times the job may be attempted.
22+
*/
23+
public int $tries = 3;
24+
25+
/**
26+
* Delay (in seconds) between retry attempts, to ride out transient
27+
* pg_dump failures caused by concurrent schema changes (e.g. deployments).
28+
*
29+
* @var array<int, int>
30+
*/
31+
public array $backoff = [60, 300];
32+
2033
/**
2134
* Execute the job.
2235
*/

config/database.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
'dump' => [
2020
'use_single_transaction',
2121
'timeout' => 620 * 100, // 51 minute timeout
22-
'exclude_tables' => ['versions'],
22+
// mols/fps are ephemeral RDKit search caches dropped & rebuilt daily by nmrxiv:index-molecules, excluded to avoid pg_dump racing that DDL
23+
'exclude_tables' => ['versions', 'mols', 'fps'],
2324
],
2425
'search_path' => 'public',
2526
],

routes/console.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020

2121
Schedule::command('nmrxiv:publish-embargo-projects')->daily();
2222
Schedule::command('nmrxiv:delete-projects')->daily();
23-
Schedule::command('nmrxiv:index-molecules')->daily();
23+
// Staggered away from the backup dump (both defaulted to ->daily(), i.e. midnight) since this rebuilds the mols/fps RDKit tables via DROP/CREATE DDL
24+
Schedule::command('nmrxiv:index-molecules')->dailyAt('02:00');
2425
Schedule::command('nmrxiv:index-spectra-metadata-stats')->daily();
2526
Schedule::command('nmrxiv:delete-citations')->weekly();
2627
Schedule::command('nmrxiv:delete-authors')->weekly();
2728
if (App::environment('production')) {
2829
Schedule::command('nmrxiv:backup-postgres-dump')
29-
->daily()
30+
->dailyAt('04:00')
3031
->onOneServer()
3132
->withoutOverlapping();
3233
}

0 commit comments

Comments
 (0)