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)
| 378 | // buildUpdateCacheMemoryJobWrapper builds the update_cache_memory job if cache-memory is configured. |
| 379 | // Returns the job name if created, empty string otherwise. |
| 380 | func (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. |
no test coverage detected