MCPcopy Create free account
hub / github.com/temporalio/temporal / lockTaskQueue

Function lockTaskQueue

common/persistence/sql/task_v1.go:187–214  ·  view source on GitHub ↗
(
	ctx context.Context,
	tx sqlplugin.Tx,
	tqHash uint32,
	tqId []byte,
	oldRangeID int64,
	v sqlplugin.MatchingTaskVersion,
)

Source from the content-addressed store, hash-verified

185}
186
187func lockTaskQueue(
188 ctx context.Context,
189 tx sqlplugin.Tx,
190 tqHash uint32,
191 tqId []byte,
192 oldRangeID int64,
193 v sqlplugin.MatchingTaskVersion,
194) error {
195 rangeID, err := tx.LockTaskQueues(ctx, sqlplugin.TaskQueuesFilter{
196 RangeHash: tqHash,
197 TaskQueueID: tqId,
198 }, v)
199 switch err {
200 case nil:
201 if rangeID != oldRangeID {
202 return &persistence.ConditionFailedError{
203 Msg: fmt.Sprintf("Task queue range ID was %v when it was should have been %v", rangeID, oldRangeID),
204 }
205 }
206 return nil
207
208 case sql.ErrNoRows:
209 return &persistence.ConditionFailedError{Msg: "Task queue does not exists"}
210
211 default:
212 return serviceerror.NewUnavailablef("Failed to lock task queue. Error: %v", err)
213 }
214}

Callers 3

CreateTasksMethod · 0.85
CreateTasksMethod · 0.85
UpdateTaskQueueMethod · 0.85

Calls 1

LockTaskQueuesMethod · 0.65

Tested by

no test coverage detected