MCPcopy Create free account
hub / github.com/PuerkitoBio/fetchbot / Cancel

Method Cancel

fetch.go:167–179  ·  view source on GitHub ↗

Cancel closes the Queue and drains the pending commands without processing them, allowing for a fast "stop immediately"-ish operation.

()

Source from the content-addressed store, hash-verified

165// Cancel closes the Queue and drains the pending commands without processing
166// them, allowing for a fast "stop immediately"-ish operation.
167func (q *Queue) Cancel() error {
168 select {
169 case <-q.cancelled:
170 // already cancelled, no-op
171 return nil
172 default:
173 // mark the queue as cancelled
174 close(q.cancelled)
175 // Close the Queue, that will wait for pending commands to drain
176 // will unblock any callers waiting on q.Block
177 return q.Close()
178 }
179}
180
181// Send enqueues a Command into the Fetcher. If the Queue has been closed, it
182// returns ErrQueueClosed. The Command's URL must have a Host.

Callers 3

TestCancelFunction · 0.80
TestGoroLeakFunction · 0.80
stopHandlerFunction · 0.80

Calls 1

CloseMethod · 0.95

Tested by 2

TestCancelFunction · 0.64
TestGoroLeakFunction · 0.64