Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3359730
D3870.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
676 B
Referenced Files
None
Subscribers
None
D3870.diff
View Options
diff --git a/keyserver/src/socket/redis.js b/keyserver/src/socket/redis.js
--- a/keyserver/src/socket/redis.js
+++ b/keyserver/src/socket/redis.js
@@ -31,10 +31,13 @@
})();
class RedisPublisher {
- pub: RedisClient;
+ client: ?RedisClient;
- constructor() {
- this.pub = redis.createClient(redisConfig);
+ get pub(): RedisClient {
+ if (!this.client) {
+ this.client = redis.createClient(redisConfig);
+ }
+ return this.client;
}
sendMessage(target: UpdateTarget, message: RedisMessage) {
@@ -49,7 +52,7 @@
}
end() {
- this.pub.unref();
+ this.client?.unref();
}
}
const publisher: RedisPublisher = new RedisPublisher();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 10:38 AM (20 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2579366
Default Alt Text
D3870.diff (676 B)
Attached To
Mode
D3870: [keyserver] Defer Redis publisher construction until actually used
Attached
Detach File
Event Timeline
Log In to Comment