Skip to content

Instantly share code, notes, and snippets.

@soheilhy
Created July 16, 2015 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soheilhy/efaa2e80871ecee4a51b to your computer and use it in GitHub Desktop.
Save soheilhy/efaa2e80871ecee4a51b to your computer and use it in GitHub Desktop.
EnQHandler.Rcv
func (h EnQHandler) Rcv(msg beehive.Msg, ctx beehive.RcvContext) error {
enq := msg.Data().(Enque)
dict := ctx.Dict(active)
key := string(enq.Task.Queue)
var tasks TaskRing
if val, err := dict.Get(key); err == nil {
tasks = val.(TaskRing)
}
enq.Task.ID = tasks.Stats.Enque + 1
tasks.Enque(enq.Task)
return dict.Put(key, tasks)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment