open-consul/agent/cache
Paul Banks 77e0577ff6
Add a Close method to cache that stops background goroutines. (#4746)
In a real agent the `cache` instance is alive until the agent shuts down so this is not a real leak in production, however in out test suite, every testAgent that is started and stops leaks goroutines that never get cleaned up which accumulate consuming CPU and memory through subsequent test in the `agent` package which doesn't help our test flakiness.

This adds a Close method that doesn't invalidate or clean up the cache, and still allows concurrent blocking queries to run (for up to 10 mins which might still affect tests). But at least it doesn't maintain them forever with background refresh and an expiry watcher routine.

It would be nice to cancel any outstanding blocking requests as well when we close but that requires much more invasive surgery right into our RPC protocol since we don't have a way to cancel requests currently.

Unscientifically this seems to make tests pass a bit quicker and more reliably locally but I can't really be sure of that!
2018-10-04 11:27:11 +01:00
..
cache.go Add a Close method to cache that stops background goroutines. (#4746) 2018-10-04 11:27:11 +01:00
cache_test.go Fixes #4421: General solution to stop blocking queries with index 0 (#4437) 2018-07-25 20:26:27 +01:00
entry.go agent/cache: string through attempt rather than storing on the entry 2018-06-14 09:42:15 -07:00
entry_test.go agent/cache: unit tests for ExpiryHeap, found a bug! 2018-06-14 09:42:03 -07:00
mock_Request.go agent/cache: Reorganize some files, RequestInfo struct, prepare for partitioning 2018-06-14 09:42:00 -07:00
mock_Type.go agent/cache: initial kind-of working cache 2018-06-14 09:42:00 -07:00
request.go agent/cache: address PR feedback, lots of typos 2018-06-14 09:42:03 -07:00
testing.go Get agent cache tests passing without global hit count (which is racy). 2018-06-25 12:25:37 -07:00
type.go agent/cache: update comments 2018-06-25 12:24:07 -07:00