You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Cli: Added flag to disable local lock when synchronising
This commit is contained in:
@@ -33,6 +33,7 @@ class Command extends BaseCommand {
|
|||||||
return [
|
return [
|
||||||
['--target <target>', _('Sync to provided target (defaults to sync.target config value)')],
|
['--target <target>', _('Sync to provided target (defaults to sync.target config value)')],
|
||||||
['--upgrade', _('Upgrade the sync target to the latest version.')],
|
['--upgrade', _('Upgrade the sync target to the latest version.')],
|
||||||
|
['--use-lock <value>', 'Disable local locks that prevent multiple clients from synchronizing at the same time (Default = 1)'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,6 +125,9 @@ class Command extends BaseCommand {
|
|||||||
const lockFilePath = `${require('os').tmpdir()}/synclock_${md5(escape(Setting.value('profileDir')))}`; // https://github.com/pvorb/node-md5/issues/41
|
const lockFilePath = `${require('os').tmpdir()}/synclock_${md5(escape(Setting.value('profileDir')))}`; // https://github.com/pvorb/node-md5/issues/41
|
||||||
if (!(await fs.pathExists(lockFilePath))) await fs.writeFile(lockFilePath, 'synclock');
|
if (!(await fs.pathExists(lockFilePath))) await fs.writeFile(lockFilePath, 'synclock');
|
||||||
|
|
||||||
|
const useLock = args.options.useLock !== 0;
|
||||||
|
|
||||||
|
if (useLock) {
|
||||||
try {
|
try {
|
||||||
if (await Command.isLocked(lockFilePath)) throw new Error(_('Synchronisation is already in progress.'));
|
if (await Command.isLocked(lockFilePath)) throw new Error(_('Synchronisation is already in progress.'));
|
||||||
|
|
||||||
@@ -136,6 +140,7 @@ class Command extends BaseCommand {
|
|||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const cleanUp = () => {
|
const cleanUp = () => {
|
||||||
cliUtils.redrawDone();
|
cliUtils.redrawDone();
|
||||||
|
|||||||
@@ -55,5 +55,4 @@ cd "$ROOT_DIR/packages/app-cli"
|
|||||||
npm start -- --profile "$PROFILE_DIR" batch "$CMD_FILE"
|
npm start -- --profile "$PROFILE_DIR" batch "$CMD_FILE"
|
||||||
npm start -- --profile "$PROFILE_DIR" import ~/Desktop/Joplin_17_06_2021.jex
|
npm start -- --profile "$PROFILE_DIR" import ~/Desktop/Joplin_17_06_2021.jex
|
||||||
# npm start -- --profile "$PROFILE_DIR" import ~/Desktop/Tout_18_06_2021.jex
|
# npm start -- --profile "$PROFILE_DIR" import ~/Desktop/Tout_18_06_2021.jex
|
||||||
npm start -- --profile "$PROFILE_DIR" sync
|
npm start -- --profile "$PROFILE_DIR" sync --use-lock 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user