|
@@ -112,7 +112,7 @@ async function setRelationshipsReady({ api, relationshipIds }) {
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
-async function syncPeriodic({ api, flags, storage, contentBeingSynced, contentCompleteSynced, anonymous }) {
|
|
|
|
|
|
+async function syncPeriodic({ api, flags, storage, contentBeingSynced, contentCompleteSynced }) {
|
|
const retry = () => {
|
|
const retry = () => {
|
|
setTimeout(syncPeriodic, flags.syncPeriod, {
|
|
setTimeout(syncPeriodic, flags.syncPeriod, {
|
|
api,
|
|
api,
|
|
@@ -120,7 +120,6 @@ async function syncPeriodic({ api, flags, storage, contentBeingSynced, contentCo
|
|
storage,
|
|
storage,
|
|
contentBeingSynced,
|
|
contentBeingSynced,
|
|
contentCompleteSynced,
|
|
contentCompleteSynced,
|
|
- anonymous,
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -133,7 +132,7 @@ async function syncPeriodic({ api, flags, storage, contentBeingSynced, contentCo
|
|
return retry()
|
|
return retry()
|
|
}
|
|
}
|
|
|
|
|
|
- if (!anonymous) {
|
|
|
|
|
|
+ if (!flags.anonymous) {
|
|
// Retry later if provider is not active
|
|
// Retry later if provider is not active
|
|
if (!(await api.providerIsActiveWorker())) {
|
|
if (!(await api.providerIsActiveWorker())) {
|
|
debug(
|
|
debug(
|
|
@@ -157,7 +156,7 @@ async function syncPeriodic({ api, flags, storage, contentBeingSynced, contentCo
|
|
await syncContent({ api, storage, contentBeingSynced, contentCompleteSynced })
|
|
await syncContent({ api, storage, contentBeingSynced, contentCompleteSynced })
|
|
|
|
|
|
// Only update on chain state if not in anonymous mode
|
|
// Only update on chain state if not in anonymous mode
|
|
- if (!anonymous) {
|
|
|
|
|
|
+ if (!flags.anonymous) {
|
|
const relationshipIds = await createNewRelationships({ api, contentCompleteSynced })
|
|
const relationshipIds = await createNewRelationships({ api, contentCompleteSynced })
|
|
await setRelationshipsReady({ api, relationshipIds })
|
|
await setRelationshipsReady({ api, relationshipIds })
|
|
debug(`Sync run completed, set ${relationshipIds.length} new relationships to ready`)
|
|
debug(`Sync run completed, set ${relationshipIds.length} new relationships to ready`)
|
|
@@ -170,13 +169,13 @@ async function syncPeriodic({ api, flags, storage, contentBeingSynced, contentCo
|
|
retry()
|
|
retry()
|
|
}
|
|
}
|
|
|
|
|
|
-function startSyncing(api, flags, storage, anonymous) {
|
|
|
|
|
|
+function startSyncing(api, flags, storage) {
|
|
// ids of content currently being synced
|
|
// ids of content currently being synced
|
|
const contentBeingSynced = new Map()
|
|
const contentBeingSynced = new Map()
|
|
// ids of content that completed sync and may require creating a new relationship
|
|
// ids of content that completed sync and may require creating a new relationship
|
|
const contentCompleteSynced = new Map()
|
|
const contentCompleteSynced = new Map()
|
|
|
|
|
|
- syncPeriodic({ api, flags, storage, contentBeingSynced, contentCompleteSynced, anonymous })
|
|
|
|
|
|
+ syncPeriodic({ api, flags, storage, contentBeingSynced, contentCompleteSynced })
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
module.exports = {
|