-
Notifications
You must be signed in to change notification settings - Fork 9
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
[do not merge] improving + adding features to go client #19
base: main
Are you sure you want to change the base?
Conversation
still a skeleton, but i have placeholders for what i think is the http api? some of the paths didnt work, and i had to change a ioredis setting as well for my test to pass, i'm not too sure why. it complained that the maxretrycount for redis connection was null since the basepath and token is already in the client, i felt it made sense to also use it to dial websocket so i added them, but i havent updated anything to use those functions yet. also, for some reason, you were passing token with a query parameter, but i don't understand because i couldn't see anywhere in the ts where you were parsing the token as a query param (i only see the authorization header), maybe im missing something |
@manast ok i filled in a bunch of stuff, still not completely done, but let me know if this is on the right path to what you wanted. i added context.Context to some of the existing wss based functions as well, a few are still missing proper ctx handling tho |
Sorry for the delay in reviewing this, I will do it asap- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I saw you spent some time on the WS version of the Proxy. I think it will be more important to focus on the HTTP version first. But still your changes are good to have as we will finalize the WS in the future as well.
Anyway, I wrote some comments. It would be great to have a couple more of tests for this new functionality.
_, err = c.httpClient.R(). | ||
SetBody(jobs). | ||
SetResult(out). | ||
ForceContentType("application/json"). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resty should be configured to use JSON by default so that it is not required to use ForceContentType here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wasn't sure about this because some endpoints seem to return an OK
instead of "OK"
. since the first is not valid JSON i am worried.
@@ -0,0 +1,26 @@ | |||
package proxyapi | |||
|
|||
type GetJobsResponse struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe it is more standard to have one file per struct instead of having all in this generic file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ive been splitting these out into files that make sense as ive been getting more familiar with the api.
src/index.ts
Outdated
@@ -15,6 +15,7 @@ let workersConnection: Redis | Cluster; | |||
if (config.redis.url) { | |||
connection = new IORedis(config.redis.url, { | |||
retryStrategy: () => 3000, | |||
maxRetriesPerRequest: 20, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is strange because I think this is the default value (20) for maxRetriesPerRequest in IORedis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this was really odd. for some reason it crash on my computer when it is null. maybe it is my bun version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I don't think so, what error do you get?
@manast here is the error when i dont manually specify the ioredis setting. (it in fact tells me to set to not be null)
as for websocket - if it's not finalized yet then that's fine. I just saw some issues with the impl and so did some small fixes. |
hi, im opening this pr just so you can see what im up to.
if you have any questions or wants, please bring them up
i will also ask questions to you if i have them in this PR, if that is okay? @manast