Advertisement
Guest User

Untitled

a guest
Jan 14th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.61 KB | None | 0 0
  1. func (s *PostgresSQL) proxyNotifcations() {
  2.     for {
  3.         log.Info("proxy start for loop")
  4.         if s.listener != nil {
  5.             select {
  6.             case evt, ok := <-s.listener.Notify:
  7.                 log.Infof("reviced on orginal channel. ok = %v", ok)
  8.                 if ok {
  9.                     log.Infof("Got notification from listener: %v", evt)
  10.  
  11.                     ce := changeEvent{}
  12.                     err := json.Unmarshal([]byte(evt.Extra), &ce)
  13.                     if err != nil {
  14.                         log.Errorf("Error unmarshal change event: %v", err)
  15.                     }
  16.  
  17.                     s.notifications <- ce
  18.                     // if I don't have continue here, then the for loop never runs again.
  19.                     continue
  20.                 }
  21.             }
  22.         }
  23.         return
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement