MCPcopy Create free account
hub / github.com/github/gh-aw / buildUpdateCacheMemoryJobWrapper

Method buildUpdateCacheMemoryJobWrapper

pkg/workflow/compiler_jobs.go:380–405  ·  view source on GitHub ↗

buildUpdateCacheMemoryJobWrapper builds the update_cache_memory job if cache-memory is configured. Returns the job name if created, empty string otherwise.

(data *WorkflowData, threatDetectionEnabled bool)

Source from the content-addressed store, hash-verified

378// buildUpdateCacheMemoryJobWrapper builds the update_cache_memory job if cache-memory is configured.
379// Returns the job name if created, empty string otherwise.
380func (c *Compiler) buildUpdateCacheMemoryJobWrapper(data *WorkflowData, threatDetectionEnabled bool) (string, error) {
381 if data.CacheMemoryConfig == nil || len(data.CacheMemoryConfig.Caches) == 0 {
382 return "", nil
383 }
384
385 if !threatDetectionEnabled {
386 return "", nil
387 }
388
389 compilerJobsLog.Print("Building update_cache_memory job")
390 updateCacheMemoryJob, err := c.buildUpdateCacheMemoryJob(data, threatDetectionEnabled)
391 if err != nil {
392 return "", fmt.Errorf("failed to build update_cache_memory job: %w", err)
393 }
394
395 if updateCacheMemoryJob == nil {
396 return "", nil
397 }
398
399 if err := c.jobManager.AddJob(updateCacheMemoryJob); err != nil {
400 return "", fmt.Errorf("failed to add update_cache_memory job: %w", err)
401 }
402
403 compilerJobsLog.Printf("Successfully added update_cache_memory job: %s", updateCacheMemoryJob.Name)
404 return updateCacheMemoryJob.Name, nil
405}
406
407// buildPushExperimentsStateJobWrapper builds the push_experiments_state job when experiments
408// use repo-based storage. Returns the job name if created, empty string otherwise.

Callers 1

Calls 5

PrintMethod · 0.80
AddJobMethod · 0.80
ErrorfMethod · 0.45
PrintfMethod · 0.45

Tested by

no test coverage detected