|
|
@ -56,7 +56,7 @@ func RunQueue() {
|
|
|
|
heap.Init(&queue)
|
|
|
|
heap.Init(&queue)
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
if len(queue) == 0 {
|
|
|
|
if len(queue) == 0 {
|
|
|
|
time.Sleep(100 * time.Microsecond)
|
|
|
|
time.Sleep(10 * time.Microsecond)
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
future, ok := heap.Pop(&queue).(*Future)
|
|
|
|
future, ok := heap.Pop(&queue).(*Future)
|
|
|
@ -64,7 +64,6 @@ func RunQueue() {
|
|
|
|
log_error("there's shit on the work heap")
|
|
|
|
log_error("there's shit on the work heap")
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log_info("we have a work item with delay %v", time.Since(future.ts))
|
|
|
|
|
|
|
|
if future.ts.After(time.Now()) {
|
|
|
|
if future.ts.After(time.Now()) {
|
|
|
|
time.Sleep(future.ts.Sub(time.Now()))
|
|
|
|
time.Sleep(future.ts.Sub(time.Now()))
|
|
|
|
}
|
|
|
|
}
|
|
|
|