mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-29 11:52:34 +08:00
Log unhandled errors in api and sync
This commit is contained in:
parent
039648bae8
commit
413a77c323
3 changed files with 15 additions and 7 deletions
|
@ -14,6 +14,10 @@ const {DatabaseConnector, SchedulerUtils, Logger} = require(`nylas-core`);
|
|||
global.Promise = require('bluebird');
|
||||
global.Logger = Logger.createLogger('nylas-k2-api')
|
||||
|
||||
const onUnhandledError = (err) => global.Logger.fatal(err, 'Unhandled error')
|
||||
process.on('uncaughtException', onUnhandledError)
|
||||
process.on('unhandledRejection', onUnhandledError)
|
||||
|
||||
const server = new Hapi.Server({
|
||||
connections: {
|
||||
router: {
|
||||
|
|
|
@ -5,6 +5,10 @@ const SyncProcessManager = require('./sync-process-manager');
|
|||
|
||||
global.Logger = Logger.createLogger('nylas-k2-sync')
|
||||
|
||||
const onUnhandledError = (err) => global.Logger.fatal(err, 'Unhandled error')
|
||||
process.on('uncaughtException', onUnhandledError)
|
||||
process.on('unhandledRejection', onUnhandledError)
|
||||
|
||||
const manager = new SyncProcessManager();
|
||||
|
||||
DatabaseConnector.forShared().then((db) => {
|
||||
|
|
|
@ -61,13 +61,13 @@ class SyncProcessManager {
|
|||
updateHeartbeat() {
|
||||
const key = HEARTBEAT_FOR(IDENTITY);
|
||||
const client = PubsubConnector.broadcastClient();
|
||||
client.setAsync(key, Date.now()).then(() =>
|
||||
client.expireAsync(key, HEARTBEAT_EXPIRES)
|
||||
).then(() =>
|
||||
this._logger.info({
|
||||
accounts_syncing_count: Object.keys(this._workers).length,
|
||||
}, "ProcessManager: 💘")
|
||||
)
|
||||
client.setAsync(key, Date.now())
|
||||
.then(() => client.expireAsync(key, HEARTBEAT_EXPIRES))
|
||||
.then(() => {
|
||||
this._logger.info({
|
||||
accounts_syncing_count: Object.keys(this._workers).length,
|
||||
}, "ProcessManager: 💘")
|
||||
})
|
||||
}
|
||||
|
||||
onSigInt() {
|
||||
|
|
Loading…
Reference in a new issue