mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
add custom headers to outdial, save unique uuid for running FS to redis
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
const assert = require('assert');
|
||||
const noopLogger = {info: () => {}, error: () => {}};
|
||||
const {LifeCycleEvents} = require('./constants');
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
const {LifeCycleEvents, FS_UUID_SET_NAME} = require('./constants');
|
||||
const Emitter = require('events');
|
||||
const debug = require('debug')('jambonz:feature-server');
|
||||
const noopLogger = {info: () => {}, error: () => {}};
|
||||
|
||||
module.exports = (logger) => {
|
||||
logger = logger || noopLogger;
|
||||
@@ -89,9 +90,13 @@ module.exports = (logger) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const {srf} = require('../..');
|
||||
if (process.env.K8S) {
|
||||
logger.info('disabling OPTIONS pings since we are running as a kubernetes service');
|
||||
const {addToSet} = srf.locals.dbHelpers;
|
||||
const uuid = srf.locals.fsUUID = uuidv4();
|
||||
addToSet(FS_UUID_SET_NAME, uuid)
|
||||
.catch((err) => logger.info({err}, `Error adding ${uuid} to set ${FS_UUID_SET_NAME}`));
|
||||
}
|
||||
else {
|
||||
// OPTIONS ping the SBCs from each feature server every 60 seconds
|
||||
@@ -102,7 +107,6 @@ module.exports = (logger) => {
|
||||
|
||||
// initial ping once we are up
|
||||
setTimeout(async() => {
|
||||
const {srf} = require('../..');
|
||||
|
||||
// if SBCs are auto-scaling, monitor them as they come and go
|
||||
if (!process.env.JAMBONES_SBCS) {
|
||||
|
||||
Reference in New Issue
Block a user