m

    mammoth-garden-53682

    1 month ago
    I have a situation where I am using
    optup/optdestroy.EventStreams
    to stream changes to one or more clients. The events are dispatched as expected but when my operation completes the channel I provide is continuously spammed with events that have null values and no sequence. Marshaled event:
    INFO[0028] { 'event': {"sequence":0,"timestamp":0,"Error":null} }
    Is this…expected? Am I not able to use long-lived channels for for event streams? My code is fairly straightforward:
    ...
    ctx := context.Background()
    upResp, err := stack.Up(ctx, optup.EventStreams(ec))
    ...
    
    // and in another goroutine
    ...
    for {
    		select {
    		case <-sl.Done:
    			return
    		case e := <-<http://sl.ec|sl.ec>:
    			me, _ := json.Marshal(e)
    			log.Infof("{ 'event': %s }", me)
    		}
    	}
    so it does appear that the channel is closed after update.