Skip to content

Commit

Permalink
support ignoring workload lock in RawEngine operation
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyang0 committed Mar 8, 2024
1 parent 54bdcc9 commit d955791
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 235 deletions.
14 changes: 11 additions & 3 deletions cluster/calcium/raw_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ func (c *Calcium) RawEngine(ctx context.Context, opts *types.RawEngineOptions) (
wg.Add(1)
_ = c.pool.Invoke(func() {
defer wg.Done()
err = c.withWorkloadLocked(ctx, ID, func(ctx context.Context, workload *types.Workload) error {
if opts.IgnoreLock {
var workload *types.Workload
if workload, err = c.store.GetWorkload(ctx, ID); err != nil {
return
}
msg, err = workload.RawEngine(ctx, opts)
return err
})
} else {
err = c.withWorkloadLocked(ctx, ID, func(ctx context.Context, workload *types.Workload) error {
msg, err = workload.RawEngine(ctx, opts)
return err
})
}

if err == nil {
logger.Infof(ctx, "Workload %s", ID)
Expand Down
Loading

0 comments on commit d955791

Please sign in to comment.