Merge pull request #112 from xuzixx/master

Issue 111: TestReSeekInotify failed
diff --git a/ratelimiter/memory.go b/ratelimiter/memory.go
index 8f6a578..bf3c213 100644
--- a/ratelimiter/memory.go
+++ b/ratelimiter/memory.go
@@ -5,7 +5,10 @@
 	"time"
 )
 
-const GC_SIZE int = 100
+const (
+	GC_SIZE   int           = 100
+	GC_PERIOD time.Duration = 60 * time.Second
+)
 
 type Memory struct {
 	store           map[string]LeakyBucket
@@ -44,11 +47,10 @@
 	now := time.Now()
 
 	// rate limit GC to once per minute
-	if now.Add(60*time.Second).Unix() > m.lastGCCollected.Unix() {
-
+	if now.Unix() >= m.lastGCCollected.Add(GC_PERIOD).Unix() {
 		for key, bucket := range m.store {
 			// if the bucket is drained, then GC
-			if bucket.DrainedAt().Unix() > now.Unix() {
+			if bucket.DrainedAt().Unix() < now.Unix() {
 				delete(m.store, key)
 			}
 		}