[ARVADOS] updated: d5effac093938be2b57d579cc1fecfa90310af02
Git user
git at public.curoverse.com
Thu Feb 9 12:11:44 EST 2017
Summary of changes:
services/ws/event_source.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
via d5effac093938be2b57d579cc1fecfa90310af02 (commit)
from 0fc6eaead0bf7691e99d19e74ec33636909001a7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit d5effac093938be2b57d579cc1fecfa90310af02
Author: Tom Clegg <tom at curoverse.com>
Date: Thu Feb 9 12:11:38 2017 -0500
11070: Fix startup race: clients can safely connect before/during pq setup phase.
diff --git a/services/ws/event_source.go b/services/ws/event_source.go
index 4de1d55..622084c 100644
--- a/services/ws/event_source.go
+++ b/services/ws/event_source.go
@@ -63,6 +63,8 @@ func (ps *pgEventSource) listenerProblem(et pq.ListenerEventType, err error) {
ps.cancel()
}
+// Run listens for event notifications on the "logs" channel and sends
+// them to all subscribers.
func (ps *pgEventSource) Run() {
logger(nil).Debug("pgEventSource Run starting")
defer logger(nil).Debug("pgEventSource Run finished")
@@ -71,7 +73,6 @@ func (ps *pgEventSource) Run() {
ps.cancel = cancel
defer cancel()
- ps.sinks = make(map[*pgEventSink]bool)
defer func() {
// Disconnect all clients
ps.mtx.Lock()
@@ -192,6 +193,9 @@ func (ps *pgEventSource) NewSink() eventSink {
source: ps,
}
ps.mtx.Lock()
+ if ps.sinks == nil {
+ ps.sinks = make(map[*pgEventSink]bool)
+ }
ps.sinks[sink] = true
ps.mtx.Unlock()
return sink
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list