Hopefully fix a possible race condition when Unsubscribing from the EventBus while an event is being Published

This commit is contained in:
Matthew Penner
2020-07-29 23:18:11 -06:00
parent 373dbd355e
commit 5036077152
2 changed files with 23 additions and 21 deletions

View File

@@ -26,9 +26,9 @@ func (h *Handler) ListenForExpiration(ctx context.Context) {
jwt := h.GetJwt()
if jwt != nil {
if jwt.ExpirationTime.Unix()-time.Now().Unix() <= 0 {
h.SendJson(&Message{Event: TokenExpiredEvent})
_ = h.SendJson(&Message{Event: TokenExpiredEvent})
} else if jwt.ExpirationTime.Unix()-time.Now().Unix() <= 180 {
h.SendJson(&Message{Event: TokenExpiringEvent})
_ = h.SendJson(&Message{Event: TokenExpiringEvent})
}
}
}
@@ -63,7 +63,7 @@ func (h *Handler) ListenForServerEvents(ctx context.Context) {
close(eventChannel)
default:
h.SendJson(&Message{
_ = h.SendJson(&Message{
Event: d.Topic,
Args: []string{d.Data},
})