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

Support before/after hooks on user remote RPCs #351

Closed
wants to merge 7 commits into from

Conversation

renatoaf
Copy link
Member

@renatoaf renatoaf commented Oct 9, 2023

Currently, "before" / "after" hooks are invoked only on "sys" RPCs on remote.go module.

Therefore there's no way to add before/after hooks on "user" remote requests, only via handlers.

This MR invokes the existing hooks on remote pipeline with ExecuteBeforePipeline and ExecuteAfterPipeline.

@coveralls
Copy link

coveralls commented Oct 9, 2023

Pull Request Test Coverage Report for Build 6745955476

  • 20 of 20 (100.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.05%) to 61.686%

Files with Coverage Reduction New Missed Lines %
modules/binary.go 2 73.91%
Totals Coverage Status
Change from base Build 6711890773: 0.05%
Covered Lines: 4838
Relevant Lines: 7843

💛 - Coveralls

Copy link
Contributor

@felipejfc felipejfc left a comment

Choose a reason for hiding this comment

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

I think we should create another set of hooks "remoteHooks" for Remotes as they're very different than Handlers.
Remotes -> General Server to Server RPC
Handlers -> Frontend to Backend RPC generated from a player handler call.

@renatoaf
Copy link
Member Author

renatoaf commented Nov 3, 2023

I considered doing that initially also to avoid introducing this behavior change unexpectedly, however I figured that every kind of RPC share the same "HandlerHooks" struct. For example "sys.push" and "sys.bindsession" already trigger the same set of HandlerHooks we have. Should be a small change, do you think it's worth doing the separation just for remotes?

@felipejfc
Copy link
Contributor

I considered doing that initially also to avoid introducing this behavior change unexpectedly, however I figured that every kind of RPC share the same "HandlerHooks" struct. For example "sys.push" and "sys.bindsession" already trigger the same set of HandlerHooks we have. Should be a small change, do you think it's worth doing the separation just for remotes?

I believe it is, so that we reduce the probability of human error when creating these hooks. The separation will help with clarity of what will run when. Can you adjust the PR?

@renatoaf
Copy link
Member Author

renatoaf commented Nov 20, 2023

Closing this as the work was merged/finished on this new PR: #365

@renatoaf renatoaf closed this Nov 20, 2023
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.

None yet

3 participants