Method
LockWithContext
(ctx context.Context, key, identifier string)
Source from the content-addressed store, hash-verified
| 68 | } |
| 69 | |
| 70 | func (k *keyMutex) LockWithContext(ctx context.Context, key, identifier string) error { |
| 71 | ticker := time.NewTicker(time.Second) |
| 72 | defer ticker.Stop() |
| 73 | |
| 74 | for { |
| 75 | if k.TryLock(key, identifier) { |
| 76 | return nil |
| 77 | } |
| 78 | select { |
| 79 | case <-ctx.Done(): |
| 80 | return ctx.Err() |
| 81 | case <-ticker.C: |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | func (k *keyMutex) Unlock(key string, remove bool) { |
| 87 | mux, ok := k.muxes.Load(key) |
Callers
nothing calls this directly
Tested by
no test coverage detected