aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorGravatar kinggo <lilong.21@bytedance.com> 2022-12-18 18:29:17 +0800
committerGravatar GitHub <noreply@github.com> 2022-12-18 11:29:17 +0100
commit2a572e08ef547b02bec1328c150ed31deec31d17 (patch)
treecaea9af4cb7e2c488c81fed63324dfec46b16272 /server.go
parentFixed an error caused of character when @ > 1 during proxy authentication (#1... (diff)
downloadfasthttp-2a572e08ef547b02bec1328c150ed31deec31d17.tar.gz
fasthttp-2a572e08ef547b02bec1328c150ed31deec31d17.tar.bz2
fasthttp-2a572e08ef547b02bec1328c150ed31deec31d17.zip
doc: optimize the comment of the Request.Done method (#1454)
Diffstat (limited to 'server.go')
-rw-r--r--server.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/server.go b/server.go
index 0be703c..c329907 100644
--- a/server.go
+++ b/server.go
@@ -2697,6 +2697,9 @@ func (ctx *RequestCtx) Deadline() (deadline time.Time, ok bool) {
// Done returns a channel that's closed when work done on behalf of this
// context should be canceled. Done may return nil if this context can
// never be canceled. Successive calls to Done return the same value.
+//
+// Note: Because creating a new channel for every request is just too expensive, so
+// RequestCtx.s.done is only closed when the server is shutting down
func (ctx *RequestCtx) Done() <-chan struct{} {
return ctx.s.done
}
@@ -2707,6 +2710,9 @@ func (ctx *RequestCtx) Done() <-chan struct{} {
// If Done is closed, Err returns a non-nil error explaining why:
// Canceled if the context was canceled (via server Shutdown)
// or DeadlineExceeded if the context's deadline passed.
+//
+// Note: Because creating a new channel for every request is just too expensive, so
+// RequestCtx.s.done is only closed when the server is shutting down
func (ctx *RequestCtx) Err() error {
select {
case <-ctx.s.done: