(ctx context.Context)
| 90 | } |
| 91 | |
| 92 | func (w *Watcher) loop(ctx context.Context) { |
| 93 | defer w.wg.Done() |
| 94 | defer close(w.out) |
| 95 | |
| 96 | buf := make([]blobcache.Message, 1) |
| 97 | for { |
| 98 | n, err := w.svc.Dequeue(ctx, w.qh, buf, blobcache.DequeueOpts{Min: 1}) |
| 99 | if err != nil { |
| 100 | return |
| 101 | } |
| 102 | if n == 0 { |
| 103 | continue |
| 104 | } |
| 105 | tx, err := BeginTx(ctx, w.svc, w.volh, blobcache.TxParams{ |
| 106 | Modify: false, |
| 107 | }) |
| 108 | if err != nil { |
| 109 | continue |
| 110 | } |
| 111 | select { |
| 112 | case w.out <- tx: |
| 113 | case <-ctx.Done(): |
| 114 | tx.Abort(ctx) |
| 115 | return |
| 116 | } |
| 117 | } |
| 118 | } |
no test coverage detected