Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colossus: sync - longer default interval #4924

Merged
3 changes: 2 additions & 1 deletion storage-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 3.9.0

- 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)
- 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`
- Updated `/state/data` endpoint response headers to return data objects status too i.e. (`pending` or `accepted`)
- **FIX**: Increase the default timeout value in the `extrinsicWrapper` function to match the transaction validity in the transaction pool
Expand All @@ -19,7 +20,7 @@

### 3.7.1

- Disable open-api express response validation if NODE_ENV == 'production'. This should improve response times when serving assets.
- 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)
- Include `nodeEnv` in `/api/v1/status` response, to help detect mis-configured nodes.

### 3.7.0
Expand Down
22 changes: 16 additions & 6 deletions storage-node/src/commands/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export default class Server extends ApiCommandBase {
syncInterval: flags.integer({
char: 'i',
description: 'Interval between synchronizations (in minutes)',
default: 1,
default: 20,
}),
syncRetryInterval: flags.integer({
description: 'Interval before retrying failed synchronization run (in minutes)',
default: 3,
}),
queryNodeEndpoint: flags.string({
char: 'q',
Expand Down Expand Up @@ -241,7 +245,8 @@ Supported values: warn, error, debug, info. Default:debug`,
TempDirName,
flags.syncWorkersNumber,
flags.syncWorkersTimeout,
flags.syncInterval
flags.syncInterval,
flags.syncRetryInterval
),
0
)
Expand Down Expand Up @@ -294,6 +299,7 @@ Supported values: warn, error, debug, info. Default:debug`,
* @param syncWorkersNumber - defines a number of the async processes for sync
* @param syncWorkersTimeout - downloading asset timeout
* @param syncIntervalMinutes - defines an interval between sync runs
* @param syncRetryIntervalMinutes - defines an interval before retrying sync run after critical error
*
* @returns void promise.
*/
Expand All @@ -306,12 +312,12 @@ async function runSyncWithInterval(
tempDirectory: string,
syncWorkersNumber: number,
syncWorkersTimeout: number,
syncIntervalMinutes: number
syncIntervalMinutes: number,
syncRetryIntervalMinutes: number
) {
const sleepInteval = syncIntervalMinutes * 60 * 1000
const sleepInterval = syncIntervalMinutes * 60 * 1000
const retrySleepInterval = syncRetryIntervalMinutes * 60 * 1000
while (true) {
logger.info(`Sync paused for ${syncIntervalMinutes} minute(s).`)
await sleep(sleepInteval)
try {
logger.info(`Resume syncing....`)
await performSync(
Expand All @@ -324,8 +330,12 @@ async function runSyncWithInterval(
uploadsDirectory,
tempDirectory
)
logger.info(`Sync run complete. Next run in ${syncIntervalMinutes} minute(s).`)
await sleep(sleepInterval)
} catch (err) {
logger.error(`Critical sync error: ${err}`)
logger.info(`Will retry in ${syncRetryIntervalMinutes} minute(s)`)
await sleep(retrySleepInterval)
}
}
}
Expand Down
Loading