-
Notifications
You must be signed in to change notification settings - Fork 44
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
Post a message to slack #90
Conversation
Send message to slack when someone gets invited #89
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.
PTAL
server.js
Outdated
}) | ||
.catch(error => { | ||
console.log('FAILED: Send slack webhook', error) | ||
// reject(new Error('FAILED: Send slack webhook')) |
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.
In case of failure, we can work on max_retry
logic. Sometimes what happens is that when slack gets more load, it puts the requests in queue and sometimes those requests are also dropped. So to ensure correctness from our side we can rely on max-retry
logic and can store the value in some constant.
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, I will read about this and fix this issue.
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.
In case of failure, we can redirect error to another channel too, if we want to.
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, even after themax_retry
we can send a single request to post error on a different slack channel. No need to use max_retry
logic there because it won't benefit to waste resources on successfully sending of error 😉
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.
@yashLadha
I don't know how to do it using axios 😅
If you could send some reference , It will be very helpful
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.
Try to look for the retry params, a quick google search will get you to the solution. If you are still not able to find out, ping me I will tell you.
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 tested the code locally, worked fine.
here's output: https://iiitvadodara.slack.com/archives/CKP5MG4LA/p1562185719000100
Left a few comments.
server.js
Outdated
}) | ||
.catch(error => { | ||
console.log('FAILED: Send slack webhook', error) | ||
// reject(new Error('FAILED: Send slack webhook')) |
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.
In case of failure, we can redirect error to another channel too, if we want to.
@yashLadha axios.post(webhookURL, JSON.stringify(options),
{ retry: 5, retryDelay: 1000 })
.then(response => {
console.log('SUCCESS: Sent slack webhook:', response.data)
})
.catch(error => {
console.log('FAILED: Sent slack webhook', error)
}) I also find this amazing package https://www.npmjs.com/package/axios-retry . Which one should I use
|
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.
LGTM, just add retry logic
Avoid, using new packages. Try to implement the functionality using the
same package.
…On Fri, Jul 5, 2019 at 8:58 PM Aashutosh Rathi ***@***.***> wrote:
***@***.**** approved this pull request.
LGTM, just add retry logic
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#90?email_source=notifications&email_token=AEJSUT5IYPP43TT2SFYH7WLP55SB5A5CNFSM4H5H444KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5T4V7A#pullrequestreview-258460412>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEJSUT6JZFLM5UBPWIIAD2TP55SB5ANCNFSM4H5H444A>
.
--
Yash Ladha
|
Added max_retry logic to send request 3 times in case first failed.
@yashLadha |
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.
Promises aren't synchronous. PTAL
Fixed asynchronous behaviour
@yashLadha |
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.
PTAL, else all looks good to me.
@yashLadha |
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.
Why aren't we using async-await
?
Also, can you once check the file that all variable names are |
I tried using
I am not sure what I was doing wrong. So I ended up doing like this 😥.
Yes I followed code style as ES Lint yells if I don't follow it. And before pushing code I did used |
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.
LGTM
Send message to slack when someone gets invited
Fixes #89
Types of changes
Non Functional Requirement