Skip to content

Instantly share code, notes, and snippets.

@hauxe
Created June 21, 2018 06:46
Show Gist options
  • Save hauxe/236aaf7d48fffd03ce6d945297482c75 to your computer and use it in GitHub Desktop.
Save hauxe/236aaf7d48fffd03ce6d945297482c75 to your computer and use it in GitHub Desktop.
// GateKeeper defines gate keeper for resource
type GateKeeper struct {
ctx context.Context
cancel context.CancelFunc
mux sync.Mutex
queue chan PrioritizedEntity
}
// New new gate keeper
func New(queuedElements int) *GateKeeper {
return &GateKeeper{
queue: make(chan PrioritizedEntity, queuedElements),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment