diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-17 19:05:12 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-17 19:05:12 +0200 |
| commit | 6e2f2c80463e8d19c24edebbe85331f6b083cf06 (patch) | |
| tree | 4623d78c61651484b1dc7bc4abb882f1a35f7781 /api.js | |
| parent | 7aa7a45e3f46fd1bc3a965c0c4a40bded288d7a8 (diff) | |
| download | discordbot-6e2f2c80463e8d19c24edebbe85331f6b083cf06.tar.gz discordbot-6e2f2c80463e8d19c24edebbe85331f6b083cf06.zip | |
have timeouts as env vars
Diffstat (limited to 'api.js')
| -rw-r--r-- | api.js | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -14,6 +14,8 @@ let cache = cacheManager.caching({ ttl: 10 // s }); +const UPDATE_TIMEOUT = parseInt(process.env.UPDATE_TIMEOUT) || 60; // s + const API_FE_URL = process.env.API_FE_URL || "http://vainsocial.dev/bots/api", API_MAP_URL = process.env.API_MAP_URL || "http://vainsocial.dev/masters/", API_WS_URL = process.env.API_WS_URL || "ws://vainsocial.dev/ws", @@ -79,7 +81,7 @@ module.exports.mapGameMode = async function(id) { // be an async iterator // next() returns promises that are awaited until there is an update -module.exports.subscribeUpdates = function(name, timeout=60) { +module.exports.subscribeUpdates = function(name, timeout=UPDATE_TIMEOUT) { const channel = new Channel(), subscription = subscribe("player." + name, channel); |
