-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add missing log events * refactor event messages and include stack trace
- Loading branch information
1 parent
80fe2cc
commit 2a23ffa
Showing
6 changed files
with
67 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,35 @@ | ||
'use strict' | ||
|
||
const send = require('../../../util/ws/send') | ||
const { notifyInfo } = require('../../../util/ws/notify') | ||
const { notifyInfo, notifyError } = require('../../../util/ws/notify') | ||
|
||
module.exports = async (server, ws, msg) => { | ||
const { d, db, algoDB, strategyExecutionDB } = server | ||
const { Credential, Strategy, UserSettings, FavouriteTradingPairs, AlgoOrderParams } = db | ||
const { StrategyExecution } = strategyExecutionDB | ||
const { AlgoOrder } = algoDB | ||
const { sendDataToMetricsServer } = ws | ||
|
||
await Promise.all([ | ||
AlgoOrder.rmAll(), | ||
Credential.rmAll(), | ||
Strategy.rmAll(), | ||
UserSettings.rmAll(), | ||
FavouriteTradingPairs.rmAll(), | ||
AlgoOrderParams.rmAll(), | ||
StrategyExecution.rmAll() | ||
]) | ||
try { | ||
await Promise.all([ | ||
AlgoOrder.rmAll(), | ||
Credential.rmAll(), | ||
Strategy.rmAll(), | ||
UserSettings.rmAll(), | ||
FavouriteTradingPairs.rmAll(), | ||
AlgoOrderParams.rmAll(), | ||
StrategyExecution.rmAll() | ||
]) | ||
|
||
send(ws, ['info.auth_configured', false]) | ||
send(ws, ['info.auth_token', null]) | ||
send(ws, ['info.auth_configured', false]) | ||
send(ws, ['info.auth_token', null]) | ||
|
||
notifyInfo(ws, 'Cleared user credentials & data', ['clearedUserCredentialsAndData']) | ||
d('reset user credentials') | ||
notifyInfo(ws, 'Cleared user credentials & data', ['clearedUserCredentialsAndData']) | ||
d('reset user credentials') | ||
sendDataToMetricsServer(['clear_data_success', '[on_auth_reset] Cleared user credentials & data']) | ||
} catch (e) { | ||
notifyError(ws, 'Failed to clear user credentials & data', ['clearedUserCredentialsAndDataFailed']) | ||
d('failed to reset user credentials %s', e.stack) | ||
sendDataToMetricsServer(['clear_data_failed', e.stack]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters