feng-y commented on PR #3309:
URL: https://github.com/apache/brpc/pull/3309#issuecomment-4550826062
Thanks for the feedback! I've updated the implementation based on your
suggestions:
## Changes Made
1. **Removed global gflag** - Now uses a controller-level flag instead
2. **Automatic flag setting** - The flag is automatically set to `true` when
`set_after_rpc_resp_fn()` is called
3. **Updated HTTP protocol** - Applied the same logic to
`http_rpc_protocol.cpp`
## How It Works
When a user sets an after-response callback:
```cpp
controller.set_after_rpc_resp_fn([](Controller* cntl, const Message* req,
const Message* res) {
// Custom callback logic
});
// Flag is automatically set to true here
```
The `ConcurrencyRemover` will then automatically manage the lifecycle to
cover the callback execution.
## Benefits
- ✅ No global configuration needed
- ✅ Automatic opt-in based on usage
- ✅ Backward compatible (default behavior unchanged)
- ✅ Consistent across both baidu_rpc and http protocols
Please let me know if there are any other concerns!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]