summaryrefslogtreecommitdiff
path: root/system/db
diff options
context:
space:
mode:
authorKevin Keuning <kkeuning@gmail.com>2017-04-14 16:18:12 -0500
committerKevin Keuning <kkeuning@gmail.com>2017-04-14 16:18:12 -0500
commit19c8b41621a73d19ba74f3b2fc82ae53206d242c (patch)
tree66198508db02d154f4ce6bc260b81fec8b35bec4 /system/db
parent6097361fc47a361800ad35a11d6fe3719b2ae0a4 (diff)
simpler throttle
Diffstat (limited to 'system/db')
-rw-r--r--system/db/content.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/system/db/content.go b/system/db/content.go
index e573e79..b503a60 100644
--- a/system/db/content.go
+++ b/system/db/content.go
@@ -600,16 +600,15 @@ func enoughTime(key string) bool {
// dispatch a delayed invocation in case no additional one follows
go func() {
- lastInvocationBeforeTicker, _ := lastInvocation(key) // zero value can be handled, no need for ok
- enoughTicker := time.NewTicker(waitDuration)
- select {
- case <-enoughTicker.C:
- lastInvocationAfterTicker, _ := lastInvocation(key)
- if !lastInvocationAfterTicker.After(lastInvocationBeforeTicker) {
- SortContent(key)
- }
+ lastInvocationBeforeTimer, _ := lastInvocation(key) // zero value can be handled, no need for ok
+ enoughTimer := time.NewTimer(waitDuration)
+ <-enoughTimer.C
+ lastInvocationAfterTimer, _ := lastInvocation(key)
+ if !lastInvocationAfterTimer.After(lastInvocationBeforeTimer) {
+ SortContent(key)
}
}()
+
return false
}