Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@terwey
Copy link
Collaborator

@terwey terwey commented Oct 29, 2025

  • add sqlc helper and storage API to enumerate stored HL metadata
  • introduce Info-based status refresher + converter for REST order payloads
  • refresh statuses before fill tracker rebuild and during periodic resync

- add sqlc helper and storage API to enumerate stored HL metadata
- introduce Info-based status refresher + converter for REST order payloads
- refresh statuses before fill tracker rebuild and during periodic resync
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +165 to +195
func (r *StatusRefresher) refreshOne(ctx context.Context, md metadata.Metadata) (bool, error) {
result, err := r.client.QueryOrderByCloid(ctx, md.Hex())
if err != nil {
if r.logger != nil {
r.logger.Warn("failed to query order status",
slog.String("md", md.Hex()),
slog.String("error", err.Error()))
}
return false, fmt.Errorf("query order %s: %w", md.Hex(), err)
}
if result == nil {
return false, fmt.Errorf("query order %s returned nil result", md.Hex())
}

wsOrder, err := orderResultToWsOrder(md, result)
if err != nil {
return false, fmt.Errorf("convert order %s: %w", md.Hex(), err)
}
if wsOrder == nil {
if r.logger != nil {
r.logger.Debug("order status unavailable",
slog.String("md", md.Hex()),
slog.String("query_status", string(result.Status)))
}
return false, nil
}

if err := r.store.RecordHyperliquidStatus(ctx, md, *wsOrder); err != nil {
return false, fmt.Errorf("record status %s: %w", md.Hex(), err)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip writing unchanged Hyperliquid statuses

The refresher writes a new row to hyperliquid_status_history every time it runs, regardless of whether Hyperliquid reports a different status. Because the resync loop in cmd/recomma/main.go now calls statusRefresher.Refresh every ResyncInterval (15โ€ฏs by default), this code path will insert a fresh record and emit an SSE event for every tracked order on every tick even when nothing changed. The table will grow unbounded and clients will see duplicate status updates. Consider comparing the fetched WsOrder (e.g. by Status and StatusTimestamp) to the most recent stored status and only calling RecordHyperliquidStatus when something actually changed, or limiting the refresher to startup only.

Useful? React with ๐Ÿ‘ย / ๐Ÿ‘Ž.

@terwey
Copy link
Collaborator Author

terwey commented Oct 29, 2025

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. What shall we delve into next?

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@terwey terwey merged commit 2d3bbd6 into main Oct 29, 2025
1 check passed
@terwey terwey deleted the feat/hyperliquid-status-refresh branch October 31, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants