Skip to content

Commit

Permalink
Fix conditions for restart and fix attempt (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
agusaldasoro authored Nov 8, 2021
1 parent 72ee640 commit cdddd27
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion content/src/service/synchronization/SynchronizationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ export class ClusterSynchronizationManager implements SynchronizationManager {
while (true) {
await delay(ms('5m'))

const failedToSync: boolean = this.synchronizationState == SynchronizationState.FAILED_TO_SYNC
if (failedToSync) {
ClusterSynchronizationManager.LOGGER.error(`Restarting server because it has failed to sync.`)
process.exit(1)
}

const isSyncing: boolean = this.synchronizationState == SynchronizationState.SYNCING
const lastSync: number = Date.now() - this.timeOfLastSync

Expand Down Expand Up @@ -146,7 +152,10 @@ export class ClusterSynchronizationManager implements SynchronizationManager {
private async retryFailedDeployments(): Promise<void> {
while (true) {
await delay(ms('1h'))
await this.retryFailedDeploymentExecution()
const isSynced: boolean = this.synchronizationState == SynchronizationState.SYNCED
if (isSynced) {
await this.retryFailedDeploymentExecution()
}
}
}

Expand Down

0 comments on commit cdddd27

Please sign in to comment.