Skip to content

Commit 95dabab

Browse files
authored
Merge pull request #4924 from mnaamani/colossus-longer-default-sync-interval
colossus: sync - longer default interval
2 parents c569ec3 + 3ce121f commit 95dabab

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

storage-node/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### 3.9.0
22

3+
- Increase default interval between sync runs. Start sync run immediately do not wait initial interval on startup before starting sync. Adds additional optional argument to specify retry interval on failure. [#4924](https://github.com/Joystream/joystream/pull/4924)
34
- Add background pruning worker to delete data objects which the node is no longer obligated to store. New optional argument `--cleanup` and `--cleanupInterval`
45
- Added new `AcceptPendingObjectsService` that is responsible for periodically sending batch `accept_pending_data_objects` for all the pending data objects. The `POST /files` endpoint now no longer calls the `accept_pending_data_objects` extrinsic for individual uploads, instead, it registers all the pending objects with `AcceptPendingObjectsService`
56
- Updated `/state/data` endpoint response headers to return data objects status too i.e. (`pending` or `accepted`)
@@ -20,7 +21,7 @@
2021

2122
### 3.7.1
2223

23-
- Disable open-api express response validation if NODE_ENV == 'production'. This should improve response times when serving assets.
24+
- Disable open-api express response validation if NODE_ENV == 'production'. This should improve response times when serving assets. [#4810](https://github.com/Joystream/joystream/pull/4810)
2425
- Include `nodeEnv` in `/api/v1/status` response, to help detect mis-configured nodes.
2526

2627
### 3.7.0

storage-node/src/commands/server.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ export default class Server extends ApiCommandBase {
6565
syncInterval: flags.integer({
6666
char: 'i',
6767
description: 'Interval between synchronizations (in minutes)',
68-
default: 1,
68+
default: 20,
69+
}),
70+
syncRetryInterval: flags.integer({
71+
description: 'Interval before retrying failed synchronization run (in minutes)',
72+
default: 3,
6973
}),
7074
cleanup: flags.boolean({
7175
char: 'c',
@@ -255,7 +259,8 @@ Supported values: warn, error, debug, info. Default:debug`,
255259
TempDirName,
256260
flags.syncWorkersNumber,
257261
flags.syncWorkersTimeout,
258-
flags.syncInterval
262+
flags.syncInterval,
263+
flags.syncRetryInterval
259264
),
260265
0
261266
)
@@ -338,6 +343,7 @@ Supported values: warn, error, debug, info. Default:debug`,
338343
* @param syncWorkersNumber - defines a number of the async processes for sync
339344
* @param syncWorkersTimeout - downloading asset timeout
340345
* @param syncIntervalMinutes - defines an interval between sync runs
346+
* @param syncRetryIntervalMinutes - defines an interval before retrying sync run after critical error
341347
*
342348
* @returns void promise.
343349
*/
@@ -350,12 +356,12 @@ async function runSyncWithInterval(
350356
tempDirectory: string,
351357
syncWorkersNumber: number,
352358
syncWorkersTimeout: number,
353-
syncIntervalMinutes: number
359+
syncIntervalMinutes: number,
360+
syncRetryIntervalMinutes: number
354361
) {
355-
const sleepInteval = syncIntervalMinutes * 60 * 1000
362+
const sleepInterval = syncIntervalMinutes * 60 * 1000
363+
const retrySleepInterval = syncRetryIntervalMinutes * 60 * 1000
356364
while (true) {
357-
logger.info(`Sync paused for ${syncIntervalMinutes} minute(s).`)
358-
await sleep(sleepInteval)
359365
try {
360366
logger.info(`Resume syncing....`)
361367
await performSync(
@@ -368,8 +374,12 @@ async function runSyncWithInterval(
368374
uploadsDirectory,
369375
tempDirectory
370376
)
377+
logger.info(`Sync run complete. Next run in ${syncIntervalMinutes} minute(s).`)
378+
await sleep(sleepInterval)
371379
} catch (err) {
372380
logger.error(`Critical sync error: ${err}`)
381+
logger.info(`Will retry in ${syncRetryIntervalMinutes} minute(s)`)
382+
await sleep(retrySleepInterval)
373383
}
374384
}
375385
}

0 commit comments

Comments
 (0)