Skip to content

Commit 3e1f6f6

Browse files
committed
use env variable in hours instead of fixed 6 hours
1 parent c4496a9 commit 3e1f6f6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backend/internal/ip_ranges.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ const regIpV6 = /^(([\da-fA-F]+)?:)+\/\d+/;
1414

1515
const internalIpRanges = {
1616

17-
interval_timeout: 1000 * 60 * 60 * 6, // 6 hours
17+
interval_timeout: 1000 * 60 * 60 * 24, // 24 hours
1818
interval: null,
1919
interval_processing: false,
2020
iteration_count: 0,
2121

2222
initTimer: () => {
23+
let timerExecutedEvery = 24;
24+
if (typeof process.env.IPRANGE_RENEWAL_INTERVAL_IN_HOURS !== 'undefined') {
25+
internalIpRanges.interval_timeout = process.env.IPRANGE_RENEWAL_INTERVAL_IN_HOURS * 1000 * 60 * 60;
26+
timerExecutedEvery = process.env.IPRANGE_RENEWAL_INTERVAL_IN_HOURS;
27+
}
28+
logger.info('Timer for ipranges renewal will be executed every ' + timerExecutedEvery + ' hour(s)');
2329
logger.info('IP Ranges Renewal Timer initialized');
2430
internalIpRanges.interval = setInterval(internalIpRanges.fetch, internalIpRanges.interval_timeout);
2531
},

0 commit comments

Comments
 (0)