Replace deprecated prometheus.InstrumentHandler and unsafe time.Ticker

This commit is contained in:
Andrew Morgan 2019-12-17 16:47:45 +00:00
parent e959927d0a
commit 8fb2c9c33c
5 changed files with 124 additions and 34 deletions

View file

@ -85,7 +85,7 @@ func (t *Cache) AddTransaction(accessToken, txnID string, res *util.JSONResponse
// It guarantees that an entry will be present in cache for at least cleanupPeriod & at most 2 * cleanupPeriod.
// This cycles the txnMaps forward, i.e. back map is assigned the front and front is assigned an empty map.
func cacheCleanService(t *Cache) {
ticker := time.Tick(t.cleanupPeriod)
ticker := time.NewTicker(t.cleanupPeriod).C
for range ticker {
t.Lock()
t.txnsMaps[1] = t.txnsMaps[0]