Merge pull request #7 from DavidSouther/fluctuating-latency
Currency service injects additional latency on predictable schedule (100ms latency from 8am to 5pm server local time)
This commit is contained in:
commit
e195d90ba4
1 changed files with 7 additions and 1 deletions
|
@ -71,7 +71,13 @@ function _loadProto (path) {
|
||||||
*/
|
*/
|
||||||
function _getCurrencyData (callback) {
|
function _getCurrencyData (callback) {
|
||||||
const data = require('./data/currency_conversion.json');
|
const data = require('./data/currency_conversion.json');
|
||||||
callback(data);
|
// Currency conversion API slows down during peak hours.
|
||||||
|
let delay = 0;
|
||||||
|
const hour = new Date().getHours();
|
||||||
|
if (hour > 8 && hour < 17) {
|
||||||
|
delay = 100; // add 100ms slowdown
|
||||||
|
}
|
||||||
|
setTimeout(() => callback(data), delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue