You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Chore: Implement cSpell to detect spelling mistakes in codebase (#10001)
Co-authored-by: Helmut K. C. Tessarek <tessarek@evermeet.cx> Co-authored-by: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com>
This commit is contained in:
@ -6,7 +6,7 @@ import { isNetworkSyncTarget, fileApi, setupDatabaseAndSynchronizer, synchronize
|
||||
// ECONNRESET and similar errors (Dropbox or OneDrive migth also throttle). Also we can't use a
|
||||
// low lock TTL value because the lock might expire between the time it's written and the time it's checked.
|
||||
// For that reason we add this multiplier for non-memory sync targets.
|
||||
const timeoutMultipler = isNetworkSyncTarget() ? 100 : 1;
|
||||
const timeoutMultiplier = isNetworkSyncTarget() ? 100 : 1;
|
||||
|
||||
let lockHandler_: LockHandler = null;
|
||||
|
||||
@ -80,11 +80,11 @@ describe('synchronizer_LockHandler', () => {
|
||||
}));
|
||||
|
||||
it('should auto-refresh a lock', (async () => {
|
||||
const handler = newLockHandler({ autoRefreshInterval: 100 * timeoutMultipler });
|
||||
const handler = newLockHandler({ autoRefreshInterval: 100 * timeoutMultiplier });
|
||||
const lock = await handler.acquireLock(LockType.Sync, LockClientType.Desktop, '111');
|
||||
const lockBefore = activeLock(await handler.locks(), new Date(), handler.lockTtl, LockType.Sync, LockClientType.Desktop, '111');
|
||||
handler.startAutoLockRefresh(lock, () => {});
|
||||
await msleep(500 * timeoutMultipler);
|
||||
await msleep(500 * timeoutMultiplier);
|
||||
const lockAfter = activeLock(await handler.locks(), new Date(), handler.lockTtl, LockType.Sync, LockClientType.Desktop, '111');
|
||||
expect(lockAfter.updatedTime).toBeGreaterThan(lockBefore.updatedTime);
|
||||
handler.stopAutoLockRefresh(lock);
|
||||
@ -92,8 +92,8 @@ describe('synchronizer_LockHandler', () => {
|
||||
|
||||
it('should call the error handler when lock has expired while being auto-refreshed', (async () => {
|
||||
const handler = newLockHandler({
|
||||
lockTtl: 50 * timeoutMultipler,
|
||||
autoRefreshInterval: 200 * timeoutMultipler,
|
||||
lockTtl: 50 * timeoutMultiplier,
|
||||
autoRefreshInterval: 200 * timeoutMultiplier,
|
||||
});
|
||||
|
||||
const lock = await handler.acquireLock(LockType.Sync, LockClientType.Desktop, '111');
|
||||
@ -103,7 +103,7 @@ describe('synchronizer_LockHandler', () => {
|
||||
});
|
||||
|
||||
try {
|
||||
await msleep(250 * timeoutMultipler);
|
||||
await msleep(250 * timeoutMultiplier);
|
||||
|
||||
expect(autoLockError).toBeTruthy();
|
||||
expect(autoLockError.code).toBe('lockExpired');
|
||||
@ -133,13 +133,13 @@ describe('synchronizer_LockHandler', () => {
|
||||
}));
|
||||
|
||||
it('should allow exclusive lock if the sync locks have expired', (async () => {
|
||||
const lockHandler = newLockHandler({ lockTtl: 500 * timeoutMultipler });
|
||||
const lockHandler = newLockHandler({ lockTtl: 500 * timeoutMultiplier });
|
||||
if (lockHandler.useBuiltInLocks) return; // Tested server side
|
||||
|
||||
await lockHandler.acquireLock(LockType.Sync, LockClientType.Mobile, '111');
|
||||
await lockHandler.acquireLock(LockType.Sync, LockClientType.Mobile, '222');
|
||||
|
||||
await msleep(600 * timeoutMultipler);
|
||||
await msleep(600 * timeoutMultiplier);
|
||||
|
||||
await expectNotThrow(async () => {
|
||||
await lockHandler.acquireLock(LockType.Exclusive, LockClientType.Desktop, '333');
|
||||
|
Reference in New Issue
Block a user