Skip to content

Commit 317e036

Browse files
committed
Keep retring app repo initialisation, sometimes it can fail with bad SSL cert on Pi if system clock is not yet setup
1 parent 641841b commit 317e036

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/umbreld/source/modules/apps/app-store.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import pRetry from 'p-retry'
2+
13
import type Umbreld from '../../index.js'
24
import runEvery from '../utilities/run-every.js'
35
import AppRepository from './app-repository.js'
@@ -26,6 +28,14 @@ export default class AppStore {
2628

2729
// Initialise repositories
2830
this.logger.log(`Initialising repositories...`)
31+
await pRetry(() => this.update(), {
32+
onFailedAttempt: (error) => {
33+
this.logger.error(
34+
`Attempt ${error.attemptNumber} initialising repositories failed. There are ${error.retriesLeft} retries left.`,
35+
)
36+
},
37+
retries: 5, // This will do exponential backoff for 1s, 2s, 4s, 8s, 16s
38+
})
2939
await this.update()
3040
this.logger.log(`Repositories initialised!`)
3141

0 commit comments

Comments
 (0)