You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Server: Display NTP server domain and port when there is an error, and display message when NTP check is skipped
This commit is contained in:
		| @@ -38,8 +38,9 @@ export async function getDeviceTimeDrift(): Promise<number> { | ||||
| 			break; | ||||
| 		} catch (error) { | ||||
| 			if (tryCount >= maxTries) { | ||||
| 				error.message = `Cannot retrieve the network time: ${error.message}`; | ||||
| 				throw error; | ||||
| 				const newError = typeof error === 'string' ? new Error(error) : error; | ||||
| 				newError.message = `Cannot retrieve the network time from ${server.domain}:${server.port}: ${newError.message}`; | ||||
| 				throw newError; | ||||
| 			} else { | ||||
| 				await time.msleep(tryCount * 1000); | ||||
| 			} | ||||
|   | ||||
| @@ -254,9 +254,11 @@ async function main() { | ||||
| 		if (config().maxTimeDrift) { | ||||
| 			const timeDrift = await getDeviceTimeDrift(); | ||||
| 			if (Math.abs(timeDrift) > config().maxTimeDrift) { | ||||
| 				throw new Error(`The device time drift is ${timeDrift}ms (Max allowed: ${config().maxTimeDrift}ms) - cannot continue as it could cause data loss and conflicts on the sync clients. You may increase env var MAX_TIME_DRIFT to pass the check.`); | ||||
| 				throw new Error(`The device time drift is ${timeDrift}ms (Max allowed: ${config().maxTimeDrift}ms) - cannot continue as it could cause data loss and conflicts on the sync clients. You may increase env var MAX_TIME_DRIFT to pass the check, or set to 0 to disabled the check.`); | ||||
| 			} | ||||
| 			appLogger().info(`NTP time offset: ${timeDrift}ms`); | ||||
| 		} else { | ||||
| 			appLogger().info('Skipping NTP time check because MAX_TIME_DRIFT is 0.'); | ||||
| 		} | ||||
|  | ||||
| 		appLogger().info('Running in Docker:', runningInDocker()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user