diff --git a/app/config/jobs.js b/app/config/jobs.js index eb872ba0bc17dbd650e6116eb0f8c7805086bc78..9b7b93a98ab5c2bdd8bfcd186079450b34cca014 100644 --- a/app/config/jobs.js +++ b/app/config/jobs.js @@ -1,11 +1,11 @@ const defaults = { - channelTimeToLive: 1000 * 60 * 60 * 24 * 28, // 4 weeks channelDestructionInterval: 1000 * 60 * 60, // 1 hr channelDestructionGracePeriod: 1000 * 60 * 60 * 24, // 1 day + channelExpiryInMillis: 1000 * 60 * 60 * 24 * 7, // 1 week healthcheckInterval: 1000 * 60 * 15, // 15 min - hotlineMessageExpiryInMillis: 1000 * 60 * 60 * 24 * 28, // 4 weeks + hotlineMessageExpiryInMillis: 1000 * 60 * 60 * 24 * 3, // 3 days inviteDeletionInterval: 1000 * 60 * 60, // 1 hour - inviteExpiryInMillis: 1000 * 60 * 60 * 24 * 14, // 2 weeks + inviteExpiryInMillis: 1000 * 60 * 60 * 24 * 7, // 1 week signaldStartupTime: 3000 * 60, // 3 min } @@ -13,9 +13,9 @@ const testInterval = 50 const development = { ...defaults, - channelTimeToLive: 1000 * 60 * 60 * 24 * 365 * 2, // 2 yr channelDestructionInterval: 1000 * 60 * 60 * 24, // 1 day channelDestructionGracePeriod: 1000 * 60 * 60 * 24 * 28, // 4 weeks + channelExpiryInMillis: 1000 * 60 * 60 * 24 * 365 * 2, // 2 yr healthcheckInterval: 1000 * 60 * 30, // 30 min signaldStartupTime: 1000 * 5, // 5 sec } @@ -23,8 +23,8 @@ const development = { const test = { ...defaults, testInterval, - channelTimeToLive: testInterval, channelDestructionInterval: testInterval, + channelExpiryInMillis: testInterval, healthcheckInterval: testInterval, // millis inviteDeletionInterval: testInterval, signaldStartupTime: 1, // millis diff --git a/app/db/repositories/channel.js b/app/db/repositories/channel.js index ddff78316187db832e4e6ee156ce43254527201b..b06125d68bedd2be727ecee51f75b30279e72847 100644 --- a/app/db/repositories/channel.js +++ b/app/db/repositories/channel.js @@ -5,7 +5,7 @@ const { loggerOf } = require('../../util') const { memberTypes } = require('./membership') const { map } = require('lodash') const { - jobs: { channelTimeToLive }, + jobs: { channelExpiryInMillis }, signal: { diagnosticsPhoneNumber }, } = require('../../config') @@ -122,7 +122,7 @@ const getStaleChannels = async () => model: app.db.messageCount, where: { updatedAt: { - [Op.lte]: util.now().subtract(parseInt(channelTimeToLive), 'ms'), + [Op.lte]: util.now().subtract(parseInt(channelExpiryInMillis), 'ms'), }, }, }, diff --git a/test/unit/db/repositories/channel.spec.js b/test/unit/db/repositories/channel.spec.js index 66771e235228c790f5bae267fe77c3d52a5dbdb4..f290f54b5f48cd7101a89df55b2789cd9f811bbb 100644 --- a/test/unit/db/repositories/channel.spec.js +++ b/test/unit/db/repositories/channel.spec.js @@ -10,7 +10,7 @@ import { channelFactory, deepChannelFactory } from '../../../support/factories/c import { genPhoneNumber } from '../../../support/factories/phoneNumber' import { membershipFactory } from '../../../support/factories/membership' const { - jobs: { channelTimeToLive }, + jobs: { channelExpiryInMillis }, signal: { diagnosticsPhoneNumber }, } = require('../../../../app/config') @@ -390,7 +390,7 @@ describe('channel repository', () => { beforeEach(async () => { staleChannels = await createChannelsFromAttributes(times(2, deepChannelFactory)) - await util.wait(channelTimeToLive + 1) + await util.wait(channelExpiryInMillis + 1) await createChannelsFromAttributes(times(1, deepChannelFactory)) })