fix memcacahed timeout
Showing
2 changed files
with
4 additions
and
7 deletions
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | const zookeeper = require('node-zookeeper-client'); | 9 | const zookeeper = require('node-zookeeper-client'); |
10 | const _ = require('lodash'); | 10 | const _ = require('lodash'); |
11 | 11 | ||
12 | -const ONE_YEAR = 60 * 60 * 24 * 365; | 12 | +const ONE_MONTH = 60 * 60 * 24 * 30; |
13 | 13 | ||
14 | const getter = (client, path, memory, cache) => { | 14 | const getter = (client, path, memory, cache) => { |
15 | client.getData( | 15 | client.getData( |
@@ -27,11 +27,8 @@ const getter = (client, path, memory, cache) => { | @@ -27,11 +27,8 @@ const getter = (client, path, memory, cache) => { | ||
27 | 27 | ||
28 | memory && _.set(memory, keys, data.toString('utf8') === 'true' ? true : false); | 28 | memory && _.set(memory, keys, data.toString('utf8') === 'true' ? true : false); |
29 | if (cache) { | 29 | if (cache) { |
30 | - try { | ||
31 | - cache.set('zookeeper:' + path, data.toString('utf8'), ONE_YEAR); | ||
32 | - console.log('cache %s data: %s', 'zookeeper:' + path, data.toString('utf8')); | ||
33 | - } catch (e) { | ||
34 | - } | 30 | + cache.set('zookeeper:' + path, data.toString('utf8'), ONE_MONTH).catch(console.error); |
31 | + console.log('cache %s data: %s', 'zookeeper:' + path, data.toString('utf8')); | ||
35 | } | 32 | } |
36 | console.log('%s data: %s', path, data.toString('utf8')); | 33 | console.log('%s data: %s', path, data.toString('utf8')); |
37 | } | 34 | } |
-
Please register or login to post a comment