Clone AppConfig and ScheduledQuery list by hand to improve CPU usage (#8794)

* Close AppConfig and ScheduledQuery list by hand to improve CPU usage

* Address review comments

* Update remaining mocks
This commit is contained in:
Tomas Touceda
2022-11-23 12:04:06 -03:00
committed by GitHub
parent 5b924ea54c
commit fe1fa4d78c
10 changed files with 110 additions and 12 deletions
+2 -2
View File
@@ -429,7 +429,7 @@ type UpdateHostSoftwareFunc func(ctx context.Context, hostID uint, software []fl
type UpdateHostFunc func(ctx context.Context, host *fleet.Host) error
type ListScheduledQueriesInPackFunc func(ctx context.Context, packID uint) ([]*fleet.ScheduledQuery, error)
type ListScheduledQueriesInPackFunc func(ctx context.Context, packID uint) (fleet.ScheduledQueryList, error)
type UpdateHostRefetchRequestedFunc func(ctx context.Context, hostID uint, value bool) error
@@ -2290,7 +2290,7 @@ func (s *DataStore) UpdateHost(ctx context.Context, host *fleet.Host) error {
return s.UpdateHostFunc(ctx, host)
}
func (s *DataStore) ListScheduledQueriesInPack(ctx context.Context, packID uint) ([]*fleet.ScheduledQuery, error) {
func (s *DataStore) ListScheduledQueriesInPack(ctx context.Context, packID uint) (fleet.ScheduledQueryList, error) {
s.ListScheduledQueriesInPackFuncInvoked = true
return s.ListScheduledQueriesInPackFunc(ctx, packID)
}