| 604 | func (r *healthCheckResult) toSessionProgress() map[string]*SessionProgress { |
| 605 | if len(r.SessionProgress) == 0 { |
| 606 | return nil |
| 607 | } |
| 608 | out := make(map[string]*SessionProgress, len(r.SessionProgress)) |
| 609 | for token, sp := range r.SessionProgress { |
| 610 | out[token] = &SessionProgress{ |
| 611 | Percentage: sp.Pct, |
| 612 | Rows: sp.Rows, |
| 613 | TotalRows: sp.Total, |
| 614 | Stalled: sp.Stalled, |
| 615 | } |
| 616 | } |
| 617 | return out |
| 618 | } |
| 619 | |
| 620 | // doHealthCheck performs a HealthCheck action on the worker. |
| 621 | // The server sends exactly one Result message with {"healthy": true, ...}. |
| 622 | // Returns the parsed result (including per-session progress) and an error if |
| 623 | // the worker is unreachable. |
| 624 | func doHealthCheck(ctx context.Context, client *flightsql.Client) (*healthCheckResult, error) { |
| 625 | return doHealthCheckWithMetadata(ctx, client, server.WorkerHealthCheckPayload{}) |
| 626 | } |
| 627 | |
| 628 | var doHealthCheckWithMetadata = doHealthCheckWithMetadataImpl |
| 629 | |
| 630 | func doHealthCheckWithMetadataImpl(ctx context.Context, client *flightsql.Client, payload server.WorkerHealthCheckPayload) (*healthCheckResult, error) { |