Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add detailed timeout error #170

Merged
merged 4 commits into from
Dec 9, 2024

Conversation

steve-chavez
Copy link
Member

Closes #169.

When a timeout occurs, now the error message is like:

Timeout of 1000 ms reached. Total time: 1000.527000 ms (DNS time: 0.084000 ms, TCP/SSL handshake time: 0.314000 ms, HTTP Request/Response time: 1000.014000 ms)

Before it used to be:

Timeout was reached

When a timeout occurs, now the error message is like:

```
Timeout of 1000 ms reached. Total time: 1000.527000 ms (DNS time: 0.084000 ms, TCP/SSL handshake time: 0.314000 ms, HTTP Request/Response time: 1000.014000 ms)
```

Before it used to be:

```
Timeout was reached
```

Closes supabase#169.
Copy link

@za-arthur za-arthur left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. All tests pass on my laptop, although I had to increase timeout in time.sleep call within test_http_detailed_timeout() and test_http_get_succeed_with_gt_timeout().

I have couple of suggestions. One is mentioned below. And the second: would it make more sense to add new column error_detail to net._http_response? That way it would be easier to make queries to the table without using pattern matching.

src/core.c Outdated

// build the error message
curl_timeout_msg result = {.msg = {}};
sprintf(result.msg,

Choose a reason for hiding this comment

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

It is safer to call snprintf to make sure that the result string won't be larger than result.msg.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, done. Also went ahead and moved all this logic to a more proper errors.hs module.

Copy link

1 similar comment
Copy link

@steve-chavez
Copy link
Member Author

would it make more sense to add new column error_detail to net._http_response? That way it would be easier to make queries to the table without using pattern matching.

@za-arthur I thought about that too, but the problem is that users will likely ignore the new detail column and the goal is for them to pay attention to these timings.

Additionally, we don't add more details to other error messages, just this one. All the other errors come raw from libcurl. So not much use for the new column.

Copy link

@za-arthur za-arthur left a comment

Choose a reason for hiding this comment

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

Thank you for the fix. LGTM.

@steve-chavez steve-chavez merged commit 9d6a6d6 into supabase:master Dec 9, 2024
7 checks passed
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.

No way to know the underlying cause of timeouts
3 participants