-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e3459c
commit 7c1dbf6
Showing
10 changed files
with
183 additions
and
138 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const {Subscription} = require('egg') | ||
|
||
class UpdateFeerateSubscription extends Subscription { | ||
static get schedule() { | ||
return { | ||
interval: '1m', | ||
type: 'worker' | ||
} | ||
} | ||
|
||
async subscribe() { | ||
let feeRate = await this.ctx.service.info.getFeeRates() | ||
if (feeRate) { | ||
await this.app.redis.hset(this.app.name, 'feerate', JSON.stringify(feeRate)) | ||
this.app.io.of('/').to('blockchain') | ||
.emit('feerate', feeRate) | ||
} | ||
} | ||
} | ||
|
||
module.exports = UpdateFeerateSubscription |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const {Subscription} = require('egg') | ||
|
||
class UpdatePriceSubscription extends Subscription { | ||
static get schedule() { | ||
return { | ||
interval: '1m', | ||
type: 'worker' | ||
} | ||
} | ||
|
||
async subscribe() { | ||
let price = await this.ctx.service.misc.getPrices() | ||
await this.app.redis.hset(this.app.name, 'qtum-price', JSON.stringify(price)) | ||
this.app.io.of('/').to('coin') | ||
.emit('qtum-price', price) | ||
} | ||
} | ||
|
||
module.exports = UpdatePriceSubscription |
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
Oops, something went wrong.