Skip to content

Commit 6e1a0a9

Browse files
committed
remove slack-notify
1 parent e6cf321 commit 6e1a0a9

8 files changed

+6
-61
lines changed

server/config/default.json

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"BASE_URL": "https://scan.testnet.tomochain.com/",
4949
"CLIENT_URL": "http://localhost:3000/",
5050
"TOMOMASTER_API_URL": "https://master.testnet.tomochain.com",
51-
"SLACK_WEBHOOK_URL": "",
5251

5352
"BLOCK_PER_EPOCH": 900,
5453
"REWARD": 250,

server/config/devnet.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
}
3333
],
3434

35-
"WEB3_URI": "https://testnet.tomochain.com/",
36-
"WEB3_WS_URI": "wss://testnet.tomochain.com/ws",
35+
"WEB3_URI": "https://devnet.tomochain.com/",
36+
"WEB3_WS_URI": "wss://devnet.tomochain.com/ws",
3737
"DEBUG_QUERY": false,
3838

3939
"BASE_UNIT": "TOMO",
@@ -46,10 +46,9 @@
4646
"SENDGRID_API_KEY": "",
4747
"SENDER_EMAIL": "[email protected]",
4848

49-
"BASE_URL": "https://scan.testnet.tomochain.com/",
49+
"BASE_URL": "https://scan.devnet.tomochain.com/",
5050
"CLIENT_URL": "http://localhost:3000/",
51-
"TOMOMASTER_API_URL": "https://master.testnet.tomochain.com",
52-
"SLACK_WEBHOOK_URL": "",
51+
"TOMOMASTER_API_URL": "https://master.devnet.tomochain.com",
5352

5453
"BLOCK_PER_EPOCH": 900,
5554
"REWARD": 250,

server/config/mainnet.json

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"BASE_URL": "https://scan.tomochain.com/",
5858
"CLIENT_URL": "http://localhost:3000/",
5959
"TOMOMASTER_API_URL": "https://master.tomochain.com",
60-
"SLACK_WEBHOOK_URL": "",
6160

6261
"BLOCK_PER_EPOCH": 900,
6362
"REWARD": 250,

server/config/testnet.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@
4646
"SENDGRID_API_KEY": "",
4747
"SENDER_EMAIL": "[email protected]",
4848

49-
"BASE_URL": "https://scan.devnet.tomochain.com/",
49+
"BASE_URL": "https://scan.testnet.tomochain.com/",
5050
"CLIENT_URL": "http://localhost:3000/",
51-
"TOMOMASTER_API_URL": "https://master.devnet.tomochain.com",
52-
"SLACK_WEBHOOK_URL": "",
51+
"TOMOMASTER_API_URL": "https://master.testnet.tomochain.com",
5352

5453
"BLOCK_PER_EPOCH": 900,
5554
"REWARD": 250,

server/package-lock.json

-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"passport": "^0.4.0",
5656
"passport-jwt": "^4.0.0",
5757
"pug": "^2.0.3",
58-
"slack-notify": "^0.1.7",
5958
"socket.io": "^2.1.0",
6059
"solc": "^0.4.25",
6160
"string-template": "^1.0.0",

server/src/index.js

-13
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ mongoose.connect(config.get('MONGODB_URI'), { useCreateIndex: true, useNewUrlPar
4848
} else {
4949
// Initialize public api
5050
app.use('/api', api)
51-
52-
// Production error handler
53-
if (config.get('APP_ENV') === 'prod') {
54-
app.use(function (err, req, res, next) {
55-
var slack = require('slack-notify')(config.get('SLACK_WEBHOOK_URL'))
56-
slack.send({
57-
channel: '#tm_explorer',
58-
text: err.stack
59-
})
60-
61-
res.sendStatus(err.status || 500)
62-
})
63-
}
6451
}
6552
})
6653

server/src/producer.js

-28
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const Web3Util = require('./helpers/web3')
44
const q = require('./queues')
55
const db = require('./models')
66
const events = require('events')
7-
// const config = require('config')
87
const logger = require('./helpers/logger')
98

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

2726
const watch = async () => {
2827
try {
29-
// let isSend = false
30-
// let isOver2Minutes = 0
3128
let step = 100
3229
let setting = await db.Setting.findOne({ meta_key: 'min_block_crawl' })
3330
let newJobSetting = await db.Setting.findOne({ meta_key: 'push_new_job' })
@@ -79,34 +76,9 @@ const watch = async () => {
7976

8077
if (minBlockCrawl > parseInt(setting.meta_value)) {
8178
setting.meta_value = minBlockCrawl
82-
// isOver2Minutes = 0
83-
// isSend = true
8479
await setting.save()
8580
newJobSetting = await db.Setting.findOne({ meta_key: 'push_new_job' })
8681
}
87-
88-
// if (String(maxBlockNum) === String(minBlockCrawl)) {
89-
// isOver2Minutes += 0.5 // Similar to 0.5 second
90-
//
91-
// // send notification after 2 minutes
92-
// if (isOver2Minutes >= 240 && isSend) {
93-
// let slack = require('slack-notify')(config.get('SLACK_WEBHOOK_URL'))
94-
// logger.info('Slack Notification - There is no new block in last 2 minutes')
95-
// await slack.send({
96-
// attachments: [
97-
// {
98-
// author_name: 'Slack Bot',
99-
// title: ':warning: WARNING',
100-
// color: 'danger',
101-
// text: '<!channel> There is no new block in last 2 minutes'
102-
// }
103-
// ]
104-
// })
105-
// isSend = false
106-
// }
107-
// logger.debug('Sleep 0.5 seconds')
108-
// await sleep(500)
109-
// }
11082
}
11183
}
11284
} catch (e) {

0 commit comments

Comments
 (0)