diff --git a/src/controllers/governance.controller.js b/src/controllers/governance.controller.js index 0f6c9a97..1f5b201f 100644 --- a/src/controllers/governance.controller.js +++ b/src/controllers/governance.controller.js @@ -37,10 +37,12 @@ export const isCreated = async (req, res) => { if (results) { return res.json({ created: true, + success: true, }); } else { return res.json({ created: false, + success: true, }); } } catch (error) { @@ -116,6 +118,7 @@ export const createGoveranceBody = async (req, res) => { return res.json({ message: 'Setting up new Governance Body on this node, this can take a few mins', + success: true, }); } catch (error) { res.status(400).json({ @@ -141,6 +144,7 @@ export const setDefaultOrgList = async (req, res) => { return res.json({ message: 'Committed this new organization list to the datalayer', + success: true, }); } catch (error) { console.trace(error); @@ -167,6 +171,7 @@ export const setPickList = async (req, res) => { return res.json({ message: 'Committed this pick list to the datalayer', + success: true, }); } catch (error) { res.status(400).json({ @@ -191,6 +196,7 @@ export const setGlossary = async (req, res) => { return res.json({ message: 'Committed glossary to the datalayer', + success: true, }); } catch (error) { res.status(400).json({ @@ -206,6 +212,7 @@ export const sync = async (req, res) => { Governance.sync(); return res.json({ message: 'Syncing Governance Body', + success: true, }); } catch (error) { res.status(400).json({ diff --git a/src/controllers/offer.controller.js b/src/controllers/offer.controller.js index de2acbaa..ab18b9a2 100644 --- a/src/controllers/offer.controller.js +++ b/src/controllers/offer.controller.js @@ -102,6 +102,7 @@ export const importOfferFile = async (req, res) => { res.json({ message: 'Offer has been imported for review.', + success: true, }); } catch (error) { console.trace(error); @@ -132,6 +133,7 @@ export const commitImportedOfferFile = async (req, res) => { res.json({ message: 'Offer Accepted.', tradeId: response.trade_id, + success: true, }); await Meta.destroy({ diff --git a/src/controllers/organization.controller.js b/src/controllers/organization.controller.js index 7ec3823f..21220d8a 100644 --- a/src/controllers/organization.controller.js +++ b/src/controllers/organization.controller.js @@ -1,3 +1,4 @@ +import { Sequelize } from 'sequelize'; import { sequelize } from '../database'; import { Organization } from '../models/organizations'; @@ -62,6 +63,7 @@ export const createV2 = async (req, res) => { return res.json({ message: 'Your organization already exists.', orgId: myOrganization.orgUid, + success: false, }); } else { const { name } = req.body; @@ -81,6 +83,7 @@ export const createV2 = async (req, res) => { return res.json({ message: 'New organization is currently being created. It can take up to 30 mins. Please do not interrupt this process.', + success: true, }); } } catch (error) { @@ -104,6 +107,7 @@ export const create = async (req, res) => { return res.json({ message: 'Your organization already exists.', orgId: myOrganization.orgUid, + success: false, }); } else { const { name, icon } = req.body; @@ -111,6 +115,7 @@ export const create = async (req, res) => { return res.json({ message: 'New organization created successfully.', + success: true, orgId: await Organization.createHomeOrganization( name, icon, @@ -135,13 +140,18 @@ export const resetHomeOrg = async (req, res) => { await Promise.all([ Organization.destroy({ where: { isHome: true } }), Staging.destroy({ - where: {}, + where: { + id: { + [Sequelize.Op.ne]: null, + }, + }, truncate: true, }), ]); res.json({ message: 'Your home organization was reset, please create a new one.', + success: true, }); } catch (error) { res.status(400).json({ @@ -162,6 +172,7 @@ export const importOrg = async (req, res) => { res.json({ message: 'Importing and subscribing organization this can take a few mins.', + success: true, }); return Organization.importOrganization(orgUid); @@ -186,6 +197,7 @@ export const importHomeOrg = async (req, res) => { res.json({ message: 'Importing home organization.', + success: true, }); } catch (error) { console.trace(error); @@ -207,6 +219,7 @@ export const subscribeToOrganization = async (req, res) => { return res.json({ message: 'Subscribed to organization', + success: true, }); } catch (error) { res.status(400).json({ @@ -242,6 +255,7 @@ export const deleteImportedOrg = async (req, res) => { return res.json({ message: 'UnSubscribed to organization, you will no longer receive updates.', + success: true, }); } catch (error) { res.status(400).json({ @@ -282,6 +296,7 @@ export const unsubscribeToOrganization = async (req, res) => { return res.json({ message: 'UnSubscribed to organization, you will no longer receive updates.', + success: true, }); } catch (error) { res.status(400).json({ @@ -322,6 +337,7 @@ export const resyncOrganization = async (req, res) => { return res.json({ message: 'Resyncing organization completed', + success: true, }); } catch (error) { res.status(400).json({ @@ -367,6 +383,7 @@ export const addMirror = async (req, res) => { await Organization.addMirror(req.body.storeId, req.body.url); return res.json({ message: `Mirror added for ${req.body.storeId}.`, + success: true, }); } catch (error) { res.status(400).json({ @@ -404,6 +421,7 @@ export const removeMirror = async (req, res) => { await Organization.removeMirror(req.body.storeId, req.body.coinId); return res.json({ message: `Mirror removed for ${req.body.storeId}.`, + success: true, }); } catch (error) { res.status(400).json({ @@ -418,6 +436,7 @@ export const sync = async (req, res) => { Organization.syncOrganizationMeta(); return res.json({ message: 'Syncing All Organizations Metadata', + success: true, }); } catch (error) { res.status(400).json({ diff --git a/src/controllers/project.controller.js b/src/controllers/project.controller.js index f376de81..1fea824f 100644 --- a/src/controllers/project.controller.js +++ b/src/controllers/project.controller.js @@ -104,6 +104,7 @@ export const create = async (req, res) => { res.json({ message: 'Project staged successfully', uuid, + success: true, }); } catch (err) { res.status(400).json({ @@ -304,6 +305,7 @@ export const updateFromXLS = async (req, res) => { res.json({ message: 'Updates from xlsx added to staging', + success: true, }); } catch (error) { console.trace(error); @@ -418,6 +420,7 @@ const update = async (req, res, isTransfer = false) => { res.json({ message: 'Project update added to staging', + success: true, }); } catch (err) { res.status(400).json({ @@ -452,6 +455,7 @@ export const destroy = async (req, res) => { res.json({ message: 'Project deleted successfully', + success: true, }); } catch (err) { res.status(400).json({ @@ -474,6 +478,7 @@ export const batchUpload = async (req, res) => { res.json({ message: 'CSV processing complete, your records have been added to the staging table.', + success: true, }); } catch (error) { logger.error('Batch Upload Failed.', error); diff --git a/src/controllers/staging.controller.js b/src/controllers/staging.controller.js index 51bee162..c40b21f7 100644 --- a/src/controllers/staging.controller.js +++ b/src/controllers/staging.controller.js @@ -1,5 +1,6 @@ import _ from 'lodash'; +import { Sequelize } from 'sequelize'; import { Staging } from '../models'; import { @@ -22,11 +23,13 @@ export const hasPendingTransactions = async (req, res) => { res.json({ confirmed: true, message: 'There are no pending transactions', + success: true, }); } catch (error) { res.json({ confirmed: false, message: 'There are currently pending transactions', + success: true, }); } }; @@ -102,7 +105,10 @@ export const commit = async (req, res) => { _.get(req, 'body.ids', []), ); - res.json({ message: 'Staging Table committed to full node' }); + res.json({ + message: 'Staging Table committed to full node', + success: true, + }); } catch (error) { console.trace(error); res.status(400).json({ @@ -125,6 +131,7 @@ export const destroy = async (req, res) => { }); res.json({ message: 'Deleted from stage', + success: true, }); } catch (error) { res.status(400).json({ @@ -140,11 +147,16 @@ export const clean = async (req, res) => { await assertIfReadOnlyMode(); await assertHomeOrgExists(); await Staging.destroy({ - where: {}, + where: { + id: { + [Sequelize.Op.ne]: null, + }, + }, truncate: true, }); res.json({ message: 'Staging Data Cleaned', + success: true, }); } catch (error) { res.status(400).json({ @@ -193,6 +205,7 @@ export const retryRecrod = async (req, res) => { ); res.json({ message: 'Staging record re-staged.', + success: true, }); } catch (error) { res.status(400).json({ diff --git a/src/controllers/units.controller.js b/src/controllers/units.controller.js index f6468172..2ebbd94a 100644 --- a/src/controllers/units.controller.js +++ b/src/controllers/units.controller.js @@ -108,6 +108,7 @@ export const create = async (req, res) => { res.json({ message: 'Unit staged successfully', uuid, + success: true, }); } catch (error) { res.status(400).json({ @@ -318,6 +319,7 @@ export const updateFromXLS = async (req, res) => { res.json({ message: 'Updates from xlsx added to staging', + success: true, }); } catch (error) { logger.error('Batch Upload Failed.', error); @@ -406,6 +408,7 @@ export const update = async (req, res) => { res.json({ message: 'Unit update added to staging', + success: true, }); } catch (err) { res.status(400).json({ @@ -437,6 +440,7 @@ export const destroy = async (req, res) => { await Staging.upsert(stagedData); res.json({ message: 'Unit deleted successfully', + success: true, }); } catch (err) { res.status(400).json({ @@ -524,6 +528,7 @@ export const split = async (req, res) => { res.json({ message: 'Unit split successful', + success: true, }); } catch (error) { res.status(400).json({ @@ -546,6 +551,7 @@ export const batchUpload = async (req, res) => { res.json({ message: 'CSV processing complete, your records have been added to the staging table.', + success: true, }); } catch (error) { logger.error('Batch Upload Failed.', error); diff --git a/src/database/index.js b/src/database/index.js index d12ab53a..102c1409 100644 --- a/src/database/index.js +++ b/src/database/index.js @@ -18,8 +18,6 @@ const mirrorConfig = (process.env.NODE_ENV || 'local') === 'local' ? 'mirror' : 'mirrorTest'; export const sequelizeMirror = new Sequelize(config[mirrorConfig]); -logger.info('CADT:mirror-database'); - const logDebounce = _.debounce(() => { console.log('Mirror DB not connected'); logger.info('Mirror DB not connected'); diff --git a/src/database/migrations/20231020201652-OrgSyncStatus.js b/src/database/migrations/20231020201652-OrgSyncStatus.js index cc62e3fa..3dc295f1 100644 --- a/src/database/migrations/20231020201652-OrgSyncStatus.js +++ b/src/database/migrations/20231020201652-OrgSyncStatus.js @@ -6,7 +6,7 @@ export default { ['organizations'].map((table) => { queryInterface.addColumn(table, 'synced', { type: Sequelize.BOOLEAN, - allowNull: true, + allowNull: false, defaultValue: false, }); }), diff --git a/src/database/migrations/20231020214357-OrgSyncRemainingCount.js b/src/database/migrations/20231020214357-OrgSyncRemainingCount.js new file mode 100644 index 00000000..8b686daa --- /dev/null +++ b/src/database/migrations/20231020214357-OrgSyncRemainingCount.js @@ -0,0 +1,23 @@ +'use strict'; + +export default { + async up(queryInterface, Sequelize) { + await Promise.all( + ['organizations'].map((table) => { + queryInterface.addColumn(table, 'sync_remaining', { + type: Sequelize.INTEGER, + allowNull: true, + defaultValue: false, + }); + }), + ); + }, + + async down(queryInterface) { + await Promise.all( + ['organizations'].map((table) => { + queryInterface.removeColumn(table, 'sync_remaining'); + }), + ); + }, +}; diff --git a/src/database/migrations/index.js b/src/database/migrations/index.js index 9c289a41..1ff83fb2 100644 --- a/src/database/migrations/index.js +++ b/src/database/migrations/index.js @@ -31,6 +31,7 @@ import ResetDBForNewSingletons from './20220816155101-reset-db-for-new-singleton import AddIsTransferColumn from './20220825124702-add-isTransfer-column'; import AddOrgMetadata from './20220831023546-add-org-metadata'; import OrgSyncStatus from './20231020201652-OrgSyncStatus'; +import OrgSyncRemaining from './20231020214357-OrgSyncRemainingCount'; export const migrations = [ { @@ -169,4 +170,8 @@ export const migrations = [ migration: OrgSyncStatus, name: '20231020201652-OrgSyncStatus', }, + { + migration: OrgSyncRemaining, + name: '20231020214357-OrgSyncRemainingCount', + }, ]; diff --git a/src/datalayer/persistance.js b/src/datalayer/persistance.js index 321c2003..fd2b5319 100644 --- a/src/datalayer/persistance.js +++ b/src/datalayer/persistance.js @@ -10,7 +10,6 @@ import { Organization } from '../models'; import { logger } from '../config/logger.cjs'; import { getChiaRoot } from '../utils/chia-root.js'; -logger.info('CADT:datalayer:persistance'); process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0; const CONFIG = getConfig().APP; diff --git a/src/datalayer/syncService.js b/src/datalayer/syncService.js index 1a02e187..e9f3dc6a 100644 --- a/src/datalayer/syncService.js +++ b/src/datalayer/syncService.js @@ -230,7 +230,7 @@ const getSubscribedStoreData = async (storeId, retry = 0) => { if (!USE_SIMULATOR) { logger.info(`Getting confirmation for ${storeId}.`); const storeExistAndIsConfirmed = await dataLayer.getRoot(storeId, true); - logger.info(`Store exists and is found ${storeId}.`); + logger.info(`Store found in DataLayer: ${storeId}.`); if (!storeExistAndIsConfirmed) { logger.info( `Retrying subscribe to ${storeId}, store not yet confirmed.`, @@ -242,9 +242,7 @@ const getSubscribedStoreData = async (storeId, retry = 0) => { ); return getSubscribedStoreData(storeId, retry + 1); } else { - logger.debug( - `Store Exists and is confirmed, proceeding to get data ${storeId}`, - ); + logger.debug(`Store is confirmed, proceeding to get data ${storeId}`); } } diff --git a/src/datalayer/writeService.js b/src/datalayer/writeService.js index c60b0618..9f825a90 100644 --- a/src/datalayer/writeService.js +++ b/src/datalayer/writeService.js @@ -10,8 +10,6 @@ import { logger } from '../config/logger.cjs'; import { Organization } from '../models'; import { publicIpv4 } from '../utils/ip-tools'; -logger.info('CADT:datalayer:writeService'); - const { USE_SIMULATOR, DATALAYER_FILE_SERVER_URL } = getConfig().APP; const createDataLayerStore = async () => { diff --git a/src/middleware.js b/src/middleware.js index 159dd213..4dbdd3ec 100644 --- a/src/middleware.js +++ b/src/middleware.js @@ -26,6 +26,7 @@ const headerKeys = Object.freeze({ WALLET_SYNCED: 'x-wallet-synced', HOME_ORGANIZATION_SYNCED: 'x-home-org-synced', ALL_DATA_SYNCED: 'x-data-synced', + SYNC_REMAINING: 'x-sync-remaining', }); const app = express(); @@ -123,6 +124,12 @@ app.use(async function (req, res, next) { const notSynced = Object.keys(orgMap).find((key) => !orgMap[key].synced); res.setHeader(headerKeys.ALL_DATA_SYNCED, !notSynced); + + const syncRemaining = Object.keys(orgMap).reduce((agg, key) => { + return agg + orgMap[key].sync_remaining; + }, 0); + + res.setHeader(headerKeys.SYNC_REMAINING, syncRemaining); next(); }); diff --git a/src/models/governance/governance.model.js b/src/models/governance/governance.model.js index ef8974d0..afc2a592 100644 --- a/src/models/governance/governance.model.js +++ b/src/models/governance/governance.model.js @@ -194,7 +194,11 @@ class Governance extends Model { const rollbackChangesIfFailed = async () => { logger.info('Reverting Goverance Records'); await Governance.destroy({ - where: {}, + where: { + id: { + [Sequelize.Op.ne]: null, + }, + }, truncate: true, }); diff --git a/src/models/organizations/organizations.model.js b/src/models/organizations/organizations.model.js index 11a9a7a2..ade30bd7 100644 --- a/src/models/organizations/organizations.model.js +++ b/src/models/organizations/organizations.model.js @@ -18,8 +18,6 @@ import { getDataModelVersion } from '../../utils/helpers'; import { getConfig } from '../../utils/config-loader'; const { USE_SIMULATOR, AUTO_SUBSCRIBE_FILESTORE } = getConfig().APP; -logger.info('CADT:organizations'); - import ModelTypes from './organizations.modeltypes.cjs'; class Organization extends Model { @@ -74,6 +72,7 @@ class Organization extends Model { 'subscribed', 'synced', 'fileStoreSubscribed', + 'sync_remaining', ], }); @@ -333,7 +332,7 @@ class Organization extends Model { static async syncOrganizationMeta() { try { const allSubscribedOrganizations = await Organization.findAll({ - subscribed: true, + where: { subscribed: true }, }); await Promise.all( diff --git a/src/models/organizations/organizations.modeltypes.cjs b/src/models/organizations/organizations.modeltypes.cjs index 77a7df85..3a66be11 100644 --- a/src/models/organizations/organizations.modeltypes.cjs +++ b/src/models/organizations/organizations.modeltypes.cjs @@ -35,9 +35,12 @@ module.exports = { }, synced: { type: Sequelize.BOOLEAN, - allowNull: true, defaultValue: false, }, + sync_remaining: { + type: Sequelize.INTEGER, + defaultValue: 0, + }, createdAt: Sequelize.DATE, updatedAt: Sequelize.DATE, }; diff --git a/src/server.js b/src/server.js index 4276aa7d..de1b58d5 100644 --- a/src/server.js +++ b/src/server.js @@ -12,8 +12,6 @@ import dotenv from 'dotenv'; dotenv.config(); -logger.info('CADT:server'); - const port = getConfig().APP.CW_PORT || 3030; const bindAddress = getConfig().APP.BIND_ADDRESS || 'localhost'; const server = http.createServer(rootRouter); diff --git a/src/tasks/sync-audit-table.js b/src/tasks/sync-audit-table.js index 9007b5f2..76b4cb77 100644 --- a/src/tasks/sync-audit-table.js +++ b/src/tasks/sync-audit-table.js @@ -1,5 +1,6 @@ import _ from 'lodash'; +import { Sequelize } from 'sequelize'; import { SimpleIntervalJob, Task } from 'toad-scheduler'; import { Organization, Audit, ModelKeys, Staging, Meta } from '../models'; import datalayer from '../datalayer'; @@ -39,26 +40,43 @@ const task = new Task('sync-audit', async () => { for (const modelKey of Object.keys(ModelKeys)) { logger.info(`Resetting ${modelKey}`); await ModelKeys[modelKey].destroy({ - where: {}, + where: { + id: { + [Sequelize.Op.ne]: null, + }, + }, truncate: true, }); } logger.info(`Resetting Audit Table`); await Audit.destroy({ - where: {}, + where: { + id: { + [Sequelize.Op.ne]: null, + }, + }, truncate: true, }); - logger.info(`Completing Migration`); await Meta.upsert({ metaKey: 'migratedToNewSync', metaValue: 'true', }); - await Organization.upsert({ - synced: false, - }); + await Organization.update( + { + synced: false, + sync_remaining: 0, + }, + { + where: { + id: { + [Sequelize.Op.ne]: null, + }, + }, + }, + ); logger.info(`Migration Complete`); } @@ -79,7 +97,7 @@ const task = new Task('sync-audit', async () => { const job = new SimpleIntervalJob( { - seconds: CONFIG?.TASKS?.AUDIT_SYNC_TASK_INTERVAL || 30, + seconds: 30, runImmediately: true, }, task, @@ -90,27 +108,13 @@ const processJob = async () => { await assertDataLayerAvailable(); await assertWalletIsSynced(); - logger.info('Syncing Registry Data'); const organizations = await Organization.findAll({ where: { subscribed: true }, raw: true, }); for (const organization of organizations) { - console.log(`Syncing ${organization.name}`); await syncOrganizationAudit(organization); - if (!CONFIG.USE_SIMULATOR) { - await new Promise((resolve) => - setTimeout( - resolve, - (CONFIG.TASKS?.AUDIT_SYNC_TASK_INTERVAL || 30) * 1000, - ), - ); - } - } - - if (!CONFIG.USE_SIMULATOR) { - await new Promise((resolve) => setTimeout(resolve, 5000)); } }; @@ -158,11 +162,17 @@ async function createTransaction(callback, afterCommitCallbacks) { const syncOrganizationAudit = async (organization) => { try { - logger.info(`Syncing Registry: ${_.get(organization, 'name')}`); let afterCommitCallbacks = []; const homeOrg = await Organization.getHomeOrg(); - const rootHistory = await datalayer.getRootHistory(organization.registryId); + const rootHistory = ( + await datalayer.getRootHistory(organization.registryId) + ).sort((a, b) => a.timestamp - b.timestamp); + + if (!rootHistory.length) { + logger.info(`No root history found for ${organization.name}`); + return; + } let lastRootSaved; @@ -173,30 +183,19 @@ const syncOrganizationAudit = async (organization) => { } else { lastRootSaved = await Audit.findOne({ where: { registryId: organization.registryId }, - order: [['createdAt', 'DESC']], + order: [['onchainConfirmationTimeStamp', 'DESC']], raw: true, }); } - if (!rootHistory.length) { - return; - } - let rootHash = _.get(rootHistory, '[0].root_hash'); - if (lastRootSaved) { - rootHash = lastRootSaved.rootHash; - } - - const historyIndex = rootHistory.findIndex( - (root) => root.root_hash === rootHash, - ); - if (!lastRootSaved) { + logger.info(`Syncing new registry ${organization.name}`); await Audit.create({ orgUid: organization.orgUid, registryId: organization.registryId, - rootHash: _.get(rootHistory, '[0].root_hash'), + rootHash, type: 'CREATE REGISTRY', change: null, table: null, @@ -218,24 +217,43 @@ const syncOrganizationAudit = async (organization) => { ); return; + } else { + rootHash = lastRootSaved.rootHash; } const isSynced = rootHistory[rootHistory.length - 1].root_hash === rootHash; + const historyIndex = rootHistory.findIndex( + (root) => root.root_hash === rootHash, + ); + await Organization.update( - { synced: isSynced }, + { + synced: isSynced, + sync_remaining: rootHistory.length - historyIndex - 1, + }, { where: { orgUid: organization.orgUid } }, ); if (isSynced) { - logger.info(`No new data to sync for ${organization.name}`); return; } + // Organization not synced, sync it + logger.info(' '); + logger.info(`Syncing Registry: ${_.get(organization, 'name')}`); + + if (!CONFIG.USE_SIMULATOR) { + await new Promise((resolve) => setTimeout(resolve, 30000)); + } + const root1 = _.get(rootHistory, `[${historyIndex}]`); const root2 = _.get(rootHistory, `[${historyIndex + 1}]`); if (!_.get(root2, 'confirmed')) { + logger.info( + `Waiting for the latest root for ${organization.name} to confirm`, + ); return; } @@ -246,6 +264,15 @@ const syncOrganizationAudit = async (organization) => { ); if (_.isEmpty(kvDiff)) { + const errorMsg = [ + `No data found for ${organization.name} in the current generation.`, + `Missing data for root hash: ${root2.root_hash}.`, + "Check your internet connection, otherwise the organization's file propagation server may be offline.", + 'Syncing for this organization will be halted until resolved.', + 'If the issue persists, contact the organization.', + ].join(' '); + + logger.error(errorMsg); return; } @@ -256,7 +283,7 @@ const syncOrganizationAudit = async (organization) => { diff.type === 'INSERT', ); - // 0x617574686F72 is hex for 'author' + // 0x617574686F72 is hex for 'author'T const author = kvDiff.filter( (diff) => (diff.key === '617574686f72' || diff.key === '0x617574686F72') && @@ -353,7 +380,7 @@ const syncOrganizationAudit = async (organization) => { } }; - return await createTransaction(updateTransaction, afterCommitCallbacks); + await createTransaction(updateTransaction, afterCommitCallbacks); } catch (error) { logger.error('Error syncing org audit', error); } diff --git a/src/tasks/sync-datalayer.js b/src/tasks/sync-datalayer.js index e202ed0e..4e8090a5 100644 --- a/src/tasks/sync-datalayer.js +++ b/src/tasks/sync-datalayer.js @@ -13,8 +13,6 @@ dotenv.config(); import { getConfig } from '../utils/config-loader'; const CONFIG = getConfig().APP; -logger.info('CADT:task:sync-datalayer'); - const spinner = new Spinner('Waiting for Updates %s'); spinner.setSpinnerString('|/-\\'); spinner.setSpinnerDelay(500); diff --git a/src/tasks/sync-default-organizations.js b/src/tasks/sync-default-organizations.js index bea96375..9ba85823 100644 --- a/src/tasks/sync-default-organizations.js +++ b/src/tasks/sync-default-organizations.js @@ -11,8 +11,6 @@ const CONFIG = getConfig().APP; import dotenv from 'dotenv'; dotenv.config(); -logger.info('CADT:task:sync-default-organizations'); - const task = new Task('sync-default-organizations', async () => { try { await assertDataLayerAvailable(); diff --git a/src/tasks/sync-governance-body.js b/src/tasks/sync-governance-body.js index 0c3b9085..de9b245e 100644 --- a/src/tasks/sync-governance-body.js +++ b/src/tasks/sync-governance-body.js @@ -14,8 +14,6 @@ const CONFIG = getConfig(); import dotenv from 'dotenv'; dotenv.config(); -logger.info('CADT:task:sync-governance'); - const task = new Task('sync-governance-meta', async () => { try { await assertDataLayerAvailable(); diff --git a/src/tasks/sync-organization-meta.js b/src/tasks/sync-organization-meta.js index fbe03827..652ccb23 100644 --- a/src/tasks/sync-organization-meta.js +++ b/src/tasks/sync-organization-meta.js @@ -12,13 +12,10 @@ const CONFIG = getConfig().APP; import dotenv from 'dotenv'; dotenv.config(); -logger.info('CADT:task:sync-organizations'); - const task = new Task('sync-organization-meta', async () => { try { await assertDataLayerAvailable(); await assertWalletIsSynced(); - logger.info('Syncing subscribed organizations'); if (!CONFIG.USE_SIMULATOR) { Organization.syncOrganizationMeta(); } diff --git a/src/tasks/sync-picklists.js b/src/tasks/sync-picklists.js index be9b8abd..0f762370 100644 --- a/src/tasks/sync-picklists.js +++ b/src/tasks/sync-picklists.js @@ -9,8 +9,6 @@ import { getConfig } from '../utils/config-loader'; const CONFIG = getConfig().APP; -logger.info('CADT:task:sync-picklists'); - const task = new Task('sync-picklist', async () => { try { await assertDataLayerAvailable(); diff --git a/src/utils/defaultConfig.js b/src/utils/defaultConfig.js index 594d5bb0..ca93057e 100644 --- a/src/utils/defaultConfig.js +++ b/src/utils/defaultConfig.js @@ -22,10 +22,8 @@ export const defaultConfig = { DATALAYER_FILE_SERVER_URL: null, AUTO_SUBSCRIBE_FILESTORE: false, TASKS: { - AUDIT_SYNC_TASK_INTERVAL: 30, - DATAMODEL_SYNC_TASK_INTERVAL: 60, GOVERNANCE_SYNC_TASK_INTERVAL: 86400, - ORGANIZATION_META_SYNC_TASK_INTERVAL: 86400, + ORGANIZATION_META_SYNC_TASK_INTERVAL: 300, PICKLIST_SYNC_TASK_INTERVAL: 30, }, },