From 814f25ad53fc166dab0b797df17579b0c205df84 Mon Sep 17 00:00:00 2001 From: Kane York Date: Sat, 21 May 2016 11:29:12 -0700 Subject: [PATCH] tests: Don't hardcode GetCommandsOfType --- socketserver/server/publisher.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/socketserver/server/publisher.go b/socketserver/server/publisher.go index 7f667f01..88463c22 100644 --- a/socketserver/server/publisher.go +++ b/socketserver/server/publisher.go @@ -195,13 +195,13 @@ func SaveLastMessage(which map[Command]map[string]LastSavedMessage, locker sync. } func GetCommandsOfType(match BacklogCacheType) []Command { - if match == CacheTypePersistent { - return PersistentCachingCommands - } else if match == CacheTypeLastOnly { - return HourlyCachingCommands - } else { - panic("unknown caching type") + var ret []Command + for cmd, info := range S2CCommandsCacheInfo { + if info.Caching == match { + ret = append(ret, cmd) + } } + return ret } func HTTPBackendDropBacklog(w http.ResponseWriter, r *http.Request) {