Lasa is a stateless proxy that generates a RSS or an Atom feed from a Standard.site publication. lasa.anhgelus.world
rss atom atprotocol standard-site atproto
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(cli): set timeout for handling requests

+17 -4
+17 -4
cmd/lasad/run.go
··· 152 152 return 153 153 } 154 154 155 - ctx, cancel := context.WithCancelCause(parent) 156 - defer cancel(errors.New("handling finished")) 155 + // timeouts request handling 156 + ctx, cancel := context.WithTimeoutCause(parent, 15*time.Second, errors.New("handling timeouts")) 157 + defer cancel() 158 + 159 + var cancelCause context.CancelCauseFunc 160 + ctx, cancelCause = context.WithCancelCause(ctx) 161 + defer cancelCause(errors.New("handling finished")) 157 162 158 163 limiter := ctx.Value(keyLimiter).(*Limiter) 159 164 status := &statusWriter{w, http.StatusOK} ··· 169 174 if err := recover(); err != nil { 170 175 w.WriteHeader(http.StatusInternalServerError) 171 176 log.Error("panic!", "error", err, "duration", time.Since(now)) 172 - if e, ok := err.(error); ok { 173 - cancel(e) 177 + switch e := err.(type) { 178 + case error: 179 + cancelCause(e) 180 + case string: 181 + cancelCause(errors.New(e)) 182 + default: 183 + log.Warn( 184 + "cannot set cancel cause, because error type is not supported", 185 + "type", fmt.Sprintf("%T", e), 186 + ) 174 187 } 175 188 } 176 189 }()