MCPcopy Create free account
hub / github.com/PostHog/duckgres / doDestroySession

Method doDestroySession

duckdbservice/flight_handler.go:293–311  ·  view source on GitHub ↗
(body []byte, stream flight.FlightService_DoActionServer)

Source from the content-addressed store, hash-verified

291 return status.Errorf(codes.Internal, "start activation drain tracking: %v", err)
292 }
293 defer finishDrain()
294
295 if err := h.pool.activateTenantFunc(payload); err != nil {
296 return status.Errorf(codes.FailedPrecondition, "activate tenant: %v", err)
297 }
298
299 resp, _ := json.Marshal(map[string]bool{"ok": true})
300 return sendActionResult(stream, &flight.Result{Body: resp})
301}
302
303func (h *FlightSQLHandler) doDestroySession(body []byte, stream flight.FlightService_DoActionServer) error {
304 var req server.WorkerDestroySessionPayload
305 if err := json.Unmarshal(body, &req); err != nil {
306 return status.Errorf(codes.InvalidArgument, "invalid DestroySession request: %v", err)
307 }
308 if req.SessionToken == "" {
309 return status.Error(codes.InvalidArgument, "session_token is required")
310 }
311 if err := h.pool.validateControlMetadata(req.WorkerControlMetadata); err != nil {
312 return status.Errorf(codes.FailedPrecondition, "stale worker owner: %v", err)
313 }
314

Callers 1

DoActionMethod · 0.80

Calls 4

sendActionResultFunction · 0.85
DestroySessionMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected