MCPcopy Create free account
hub / github.com/cloudbase/garm / GetEntityRunnerGroup

Method GetEntityRunnerGroup

cache/entity_cache.go:472–486  ·  view source on GitHub ↗
(entityID, runnerGroupName string)

Source from the content-addressed store, hash-verified

470}
471
472func (e *EntityCache) GetEntityRunnerGroup(entityID, runnerGroupName string) (int64, bool) {
473 e.mux.Lock()
474 defer e.mux.Unlock()
475
476 if _, ok := e.entities[entityID]; ok {
477 if runnerGroup, ok := e.entities[entityID].RunnerGroups[runnerGroupName]; ok {
478 if time.Now().UTC().After(runnerGroup.time.Add(1 * time.Hour)) {
479 delete(e.entities[entityID].RunnerGroups, runnerGroupName)
480 return 0, false
481 }
482 return runnerGroup.RunnerGroupID, true
483 }
484 }
485 return 0, false
486}
487
488func SetEntityRunnerGroup(entityID, runnerGroupName string, runnerGroupID int64) {
489 entityCache.SetEntityRunnerGroup(entityID, runnerGroupName, runnerGroupID)

Callers 1

GetEntityRunnerGroupFunction · 0.80

Calls 3

AddMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected