// computeWaitTime returns the Duration until the next dispatch should occur.
// Note that this may be negative.
computeWaitTime returns the Duration until the next dispatch should occur.
Note that this may be negative.
// computeWaitTime returns the Duration until the next dispatch should occur . // Note that this may be negative .
func (d *Dispatcher) computeWaitTime(currentTime time.Time) (waitTime time.Duration) {
	if d == nil {
		panic("Dispatcher is not set")
	}
	dispatchInterval := time.Duration(d.config.GetGlobalConfig().FrequencyInHours) * time.Hour
	nextDispatchTime := d.lastDispatchTime.Add(dispatchInterval)
	return nextDispatchTime.Sub(currentTime)
}
func ( d * Dispatcher ) computeWaitTime ( currentTime time . Time ) ( waitTime time . Duration ) { if d == nil { panic ( " " ) } dispatchInterval := time . Duration ( d . config . GetGlobalConfig ( ) . FrequencyInHours ) * time . Hour nextDispatchTime := d . lastDispatchTime . Add ( dispatchInterval ) return nextDispatchTime . Sub ( currentTime ) }
computeWaitTime returns the Duration until the next dispatch should occur.
computeWaitTime returns the Duration until the next dispatch should occur .