-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 HTTP-API for fetching reload result. v5.0.176 v6.0.71 #3779
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
duiniuluantanqin
approved these changes
Aug 30, 2023
winlinvip
changed the title
Support HTTP-API for fetching reload result.
Support HTTP-API for fetching reload result. v5.0.176 v6.0.71
Aug 30, 2023
winlinvip
added a commit
that referenced
this pull request
Aug 30, 2023
During a Reload, several stages will be passed through: 1. Parsing new configurations: Parse. 2. Transforming configurations: Transform. 3. Applying configurations: Apply. Previously, any error at any stage would result in a direct exit, making the system completely dependent on configuration checks: ```bash ./objs/srs -c conf/srs.conf -t echo $? ``` Optimized to: If an error occurs before applying the configuration, it can be ignored. If an error occurs during the application of the configuration, some of the configuration may have already taken effect, leading to unpredictable behavior, so SRS will exit directly. Added a new HTTP API to query the result of the reload. ```nginx http_api { enabled on; raw_api { enabled on; allow_reload on; } } ``` ```bash curl http://localhost:1985/api/v1/raw?rpc=reload-fetch ``` ```json { "code": 0, "data": { "err": 0, "msg": "Success", "state": 0, "rid": "0s6y0n9" } } { "code": 0, "data": { "err": 1023, "msg": "code=1023(ConfigInvalid) : parse file : parse buffer containers/conf/srs.release-local.conf : root parse : parse dir : parse include buffer containers/data/config/srs.vhost.conf : read token, line=0, state=0 : line 3: unexpected end of file, expecting ; or \"}\"", "state": 1, "rid": "0g4z471" } } ``` This way, you can know if the last reload of the system was successful. --------- Co-authored-by: Haibo Chen <495810242@qq.com>
duiniuluantanqin
added a commit
to duiniuluantanqin/srs
that referenced
this pull request
Sep 14, 2023
During a Reload, several stages will be passed through: 1. Parsing new configurations: Parse. 2. Transforming configurations: Transform. 3. Applying configurations: Apply. Previously, any error at any stage would result in a direct exit, making the system completely dependent on configuration checks: ```bash ./objs/srs -c conf/srs.conf -t echo $? ``` Optimized to: If an error occurs before applying the configuration, it can be ignored. If an error occurs during the application of the configuration, some of the configuration may have already taken effect, leading to unpredictable behavior, so SRS will exit directly. Added a new HTTP API to query the result of the reload. ```nginx http_api { enabled on; raw_api { enabled on; allow_reload on; } } ``` ```bash curl http://localhost:1985/api/v1/raw?rpc=reload-fetch ``` ```json { "code": 0, "data": { "err": 0, "msg": "Success", "state": 0, "rid": "0s6y0n9" } } { "code": 0, "data": { "err": 1023, "msg": "code=1023(ConfigInvalid) : parse file : parse buffer containers/conf/srs.release-local.conf : root parse : parse dir : parse include buffer containers/data/config/srs.vhost.conf : read token, line=0, state=0 : line 3: unexpected end of file, expecting ; or \"}\"", "state": 1, "rid": "0g4z471" } } ``` This way, you can know if the last reload of the system was successful. --------- Co-authored-by: Haibo Chen <495810242@qq.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reload Error Ignore
During a Reload, several stages will be passed through:
Previously, any error at any stage would result in a direct exit, making the system completely dependent on configuration checks:
Optimized to: If an error occurs before applying the configuration, it can be ignored. If an error occurs during the application of the configuration, some of the configuration may have already taken effect, leading to unpredictable behavior, so SRS will exit directly.
Reload Fetch API
Added a new HTTP API to query the result of the reload.
curl http://localhost:1985/api/v1/raw?rpc=reload-fetch
This way, you can know if the last reload of the system was successful.
Co-authored-by: Haibo Chen 495810242@qq.com