()
| 68 | } |
| 69 | |
| 70 | func (t *BaseTask) deepCopy() *BaseTask { |
| 71 | t.lock.RLock() |
| 72 | defer t.lock.RUnlock() |
| 73 | |
| 74 | newTask := &BaseTask{ |
| 75 | Id: t.Id, |
| 76 | Type: t.Type, |
| 77 | FailureCount: t.FailureCount, |
| 78 | FailureMessage: t.FailureMessage, |
| 79 | QueueName: t.QueueName, |
| 80 | QueuedAt: t.QueuedAt, |
| 81 | Metadata: t.Metadata, |
| 82 | } |
| 83 | |
| 84 | // Deep copy LogLabels |
| 85 | newTask.LogLabels = make(map[string]string) |
| 86 | for k, v := range t.LogLabels { |
| 87 | newTask.LogLabels[k] = v |
| 88 | } |
| 89 | |
| 90 | // Deep copy Props |
| 91 | newTask.Props = make(map[string]interface{}) |
| 92 | for k, v := range t.Props { |
| 93 | newTask.Props[k] = v |
| 94 | } |
| 95 | |
| 96 | // Copy atomic bool value |
| 97 | newTask.processing.Store(t.processing.Load()) |
| 98 | |
| 99 | return newTask |
| 100 | } |
| 101 | |
| 102 | func (t *BaseTask) DeepCopyWithNewUUID() Task { |
| 103 | newTask := t.deepCopy() |
no test coverage detected