Skip to content

Commit

Permalink
Fix doReload race and Cache tests
Browse files Browse the repository at this point in the history
  • Loading branch information
buger committed Dec 8, 2017
1 parent 27e8a36 commit 65f3f65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1269,5 +1269,7 @@ func TestWithCacheAllSafeRequests(t *testing.T) {
} else if !cached && tc.wantCached {
t.Fatalf("wanted %s %s to cache, but it didn't", tc.method, tc.path)
}

time.Sleep(10 * time.Millisecond)
}
}
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,12 @@ func rpcReloadLoop(rpcKey string) {
}
}

var reloadMu sync.Mutex

func doReload() {
reloadMu.Lock()
defer reloadMu.Unlock()

// Load the API Policies
syncPolicies()
// load the specs
Expand Down

0 comments on commit 65f3f65

Please sign in to comment.