webhooks.js icon indicating copy to clipboard operation
webhooks.js copied to clipboard

fix: export createNodeHandler

Open Uzlopak opened this issue 1 year ago • 12 comments

Resolves #930

I would like to have the middleware separated from the handler to use it in probot.

Resolves #ISSUE_NUMBER


Before the change?

After the change?

Pull request checklist

  • [x] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • [ ] Yes
  • [x] No

Uzlopak avatar Nov 25 '23 09:11 Uzlopak

@wolfy1339 Can you review and merge it please? :)

Uzlopak avatar Nov 25 '23 21:11 Uzlopak

I don't understand the goal here, why do we need to separate that code from the middleware?

wolfy1339 avatar Nov 25 '23 21:11 wolfy1339

@wolfy1339 The node middleware currently is also doing routing and always gets instanted.

If the handler is separated and exported we can directly use it, instantiate it once and mount it in the router. This should improve the performance significantly.

If this gets merged, i can provide a follow up PR in few hours and everything should make more sense ;)

Uzlopak avatar Nov 25 '23 22:11 Uzlopak

Once we start shipping this it will be a breaking change to remove so we need it to "make more sense" before its merged, not after.

Are you able to provide some proper benchmarks showing the performance gains you're talking about? Have you also considered inling this within probot so you can start living with it for a while and gather some feedback to help justify us adopting it here?

G-Rath avatar Nov 25 '23 22:11 G-Rath

K, when I get back at my PC i will implement a poc in probot

Uzlopak avatar Nov 25 '23 22:11 Uzlopak

@G-Rath @wolfy1339

see https://github.com/probot/probot/pull/1933

I go to sleep now :)

Uzlopak avatar Nov 26 '23 01:11 Uzlopak

I have the feeling I can improve the performance more. Have to deep dive.

Uzlopak avatar Nov 26 '23 02:11 Uzlopak

Resolves #930

I would like to have the middleware separated from the handler to use it in probot.

Resolves #ISSUE_NUMBER

Before the change?

After the change?

Pull request checklist

  • [x] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • [ ] Yes
  • [x] No

Muhammadamjadm avatar Jan 23 '24 03:01 Muhammadamjadm

@Muhammadamjadm What do you mean?

Uzlopak avatar Jan 23 '24 03:01 Uzlopak

Don't worry about the comment, it's spam

wolfy1339 avatar Jan 23 '24 04:01 wolfy1339

@G-Rath @wolfy1339

see probot/probot#1933

I go to sleep now :)

Muhammadamjadm avatar Jan 23 '24 09:01 Muhammadamjadm

@Uzlopak Would something like what is described in https://github.com/octokit/webhooks.js/issues/379 be useful and helpful for you? I think it goes along with the spirit of this PR

wolfy1339 avatar Feb 24 '24 02:02 wolfy1339