Skip to content

Commit

Permalink
remove slack-notify
Browse files Browse the repository at this point in the history
  • Loading branch information
khaihkd committed Mar 18, 2019
1 parent e6cf321 commit 6e1a0a9
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 61 deletions.
1 change: 0 additions & 1 deletion server/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"BASE_URL": "https://scan.testnet.tomochain.com/",
"CLIENT_URL": "http://localhost:3000/",
"TOMOMASTER_API_URL": "https://master.testnet.tomochain.com",
"SLACK_WEBHOOK_URL": "",

"BLOCK_PER_EPOCH": 900,
"REWARD": 250,
Expand Down
9 changes: 4 additions & 5 deletions server/config/devnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
}
],

"WEB3_URI": "https://testnet.tomochain.com/",
"WEB3_WS_URI": "wss://testnet.tomochain.com/ws",
"WEB3_URI": "https://devnet.tomochain.com/",
"WEB3_WS_URI": "wss://devnet.tomochain.com/ws",
"DEBUG_QUERY": false,

"BASE_UNIT": "TOMO",
Expand All @@ -46,10 +46,9 @@
"SENDGRID_API_KEY": "",
"SENDER_EMAIL": "[email protected]",

"BASE_URL": "https://scan.testnet.tomochain.com/",
"BASE_URL": "https://scan.devnet.tomochain.com/",
"CLIENT_URL": "http://localhost:3000/",
"TOMOMASTER_API_URL": "https://master.testnet.tomochain.com",
"SLACK_WEBHOOK_URL": "",
"TOMOMASTER_API_URL": "https://master.devnet.tomochain.com",

"BLOCK_PER_EPOCH": 900,
"REWARD": 250,
Expand Down
1 change: 0 additions & 1 deletion server/config/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"BASE_URL": "https://scan.tomochain.com/",
"CLIENT_URL": "http://localhost:3000/",
"TOMOMASTER_API_URL": "https://master.tomochain.com",
"SLACK_WEBHOOK_URL": "",

"BLOCK_PER_EPOCH": 900,
"REWARD": 250,
Expand Down
5 changes: 2 additions & 3 deletions server/config/testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@
"SENDGRID_API_KEY": "",
"SENDER_EMAIL": "[email protected]",

"BASE_URL": "https://scan.devnet.tomochain.com/",
"BASE_URL": "https://scan.testnet.tomochain.com/",
"CLIENT_URL": "http://localhost:3000/",
"TOMOMASTER_API_URL": "https://master.devnet.tomochain.com",
"SLACK_WEBHOOK_URL": "",
"TOMOMASTER_API_URL": "https://master.testnet.tomochain.com",

"BLOCK_PER_EPOCH": 900,
"REWARD": 250,
Expand Down
9 changes: 0 additions & 9 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"pug": "^2.0.3",
"slack-notify": "^0.1.7",
"socket.io": "^2.1.0",
"solc": "^0.4.25",
"string-template": "^1.0.0",
Expand Down
13 changes: 0 additions & 13 deletions server/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ mongoose.connect(config.get('MONGODB_URI'), { useCreateIndex: true, useNewUrlPar
} else {
// Initialize public api
app.use('/api', api)

// Production error handler
if (config.get('APP_ENV') === 'prod') {
app.use(function (err, req, res, next) {
var slack = require('slack-notify')(config.get('SLACK_WEBHOOK_URL'))
slack.send({
channel: '#tm_explorer',
text: err.stack
})

res.sendStatus(err.status || 500)
})
}
}
})

Expand Down
28 changes: 0 additions & 28 deletions server/src/producer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const Web3Util = require('./helpers/web3')
const q = require('./queues')
const db = require('./models')
const events = require('events')
// const config = require('config')
const logger = require('./helpers/logger')

// fix warning max listener
Expand All @@ -26,8 +25,6 @@ let countJobs = () => {

const watch = async () => {
try {
// let isSend = false
// let isOver2Minutes = 0
let step = 100
let setting = await db.Setting.findOne({ meta_key: 'min_block_crawl' })
let newJobSetting = await db.Setting.findOne({ meta_key: 'push_new_job' })
Expand Down Expand Up @@ -79,34 +76,9 @@ const watch = async () => {

if (minBlockCrawl > parseInt(setting.meta_value)) {
setting.meta_value = minBlockCrawl
// isOver2Minutes = 0
// isSend = true
await setting.save()
newJobSetting = await db.Setting.findOne({ meta_key: 'push_new_job' })
}

// if (String(maxBlockNum) === String(minBlockCrawl)) {
// isOver2Minutes += 0.5 // Similar to 0.5 second
//
// // send notification after 2 minutes
// if (isOver2Minutes >= 240 && isSend) {
// let slack = require('slack-notify')(config.get('SLACK_WEBHOOK_URL'))
// logger.info('Slack Notification - There is no new block in last 2 minutes')
// await slack.send({
// attachments: [
// {
// author_name: 'Slack Bot',
// title: ':warning: WARNING',
// color: 'danger',
// text: '<!channel> There is no new block in last 2 minutes'
// }
// ]
// })
// isSend = false
// }
// logger.debug('Sleep 0.5 seconds')
// await sleep(500)
// }
}
}
} catch (e) {
Expand Down

0 comments on commit 6e1a0a9

Please sign in to comment.