-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix(retry): copy retry middleware to SDK and fix it #114
Conversation
d0a6bd5
to
66b45a3
Compare
* Client middleware that adds automatic retries to unary calls. | ||
*/ | ||
export const retryMiddleware: ClientMiddleware<RetryOptions> = async function* retryMiddleware(call, options) { | ||
const { idempotencyLevel } = call.method.options ?? {}; |
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.
Тут же вопрос только в этой строчке? Давай законтрибьютим в nice-grpc-client-middleware-retry
и воткнем сюда ссылку на PR с TODO: use nice-grpc-client-middleware-retry from npm
?
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.
По сути да. Сделаю PR. Не знаю, примут ли его, но попробовать стоит.
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.
Не вижу причин его не принятия, ведь это просто фоллбэк)
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.
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.
@DavyJohnes Как я и опасался, ПР не спешат принимать, предлагая внести исправления глубже по стеку инструментов в генератор ts_proto
.
Альтернативным решением может быть реализация ретраев на основе нативного подхода в @grpc/grpc-js
, где начиная с версии 1.8.0 появилась реализация RFC по ретраям.
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.
Альтернативным решением может быть реализация ретраев на основе нативного подхода в @grpc/grpc-js, где начиная с версии 1.8.0 появилась реализация RFC по ретраям.
Звучит отлично.
🎉 This PR is included in version 2.4.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
As retry middleware from nice-grpc-client-middleware-retry package highly relates to the way stubs are generated, I had to copy it and fix the destructuring issue.
The original middleware presumes that ts-proto is used with
--ts_proto_opt=outputServices=generic-definitions
option, that addoptions
property object to the method, so it could be later successfully destructured.closes #113