Add rate limit cache and fixes
This change adds a loop that keeps a cache of credentials rate limits as reported by the github API. The cache is updated every 30 seconds and is purely informational for the user. This change also adds some caching improvements. Functions that return values from the cache as lists, will now sort by ID or creation date. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
16af8fd97f
commit
1a719567ff
10 changed files with 276 additions and 23 deletions
3
cache/instance_cache.go
vendored
3
cache/instance_cache.go
vendored
|
|
@ -53,6 +53,7 @@ func (i *InstanceCache) GetAllInstances() []params.Instance {
|
|||
for _, instance := range i.cache {
|
||||
instances = append(instances, instance)
|
||||
}
|
||||
sortByCreationDate(instances)
|
||||
return instances
|
||||
}
|
||||
|
||||
|
|
@ -66,6 +67,7 @@ func (i *InstanceCache) GetInstancesForPool(poolID string) []params.Instance {
|
|||
filteredInstances = append(filteredInstances, instance)
|
||||
}
|
||||
}
|
||||
sortByCreationDate(filteredInstances)
|
||||
return filteredInstances
|
||||
}
|
||||
|
||||
|
|
@ -79,6 +81,7 @@ func (i *InstanceCache) GetInstancesForScaleSet(scaleSetID uint) []params.Instan
|
|||
filteredInstances = append(filteredInstances, instance)
|
||||
}
|
||||
}
|
||||
sortByCreationDate(filteredInstances)
|
||||
return filteredInstances
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue