Beispiel #1
0
func (d *Dumb) QueueNextEvent(event signal.Event) {
	item, err := queue.NewBasicTBQueueItem(event, d.Interval, d.Interval)
	if err != nil {
		panic(log.Critical(err))
	}
	d.queue.Enqueue(item)
}
Beispiel #2
0
func (r *Random) QueueNextEvent(event signal.Event) {
	minInterval := r.MinInterval
	maxInterval := r.MaxInterval
	_, prioritized := r.PrioritizedEntities[event.EntityID()]
	if prioritized {
		// FIXME: magic coefficient for prioritizing (decrease intervals)
		minInterval = time.Duration(float64(minInterval) * 0.8)
		maxInterval = time.Duration(float64(maxInterval) * 0.8)
	}
	item, err := queue.NewBasicTBQueueItem(event, minInterval, maxInterval)
	if err != nil {
		panic(log.Critical(err))
	}
	r.queue.Enqueue(item)
}