You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@casbin.apache.org by "CodingCaius (via GitHub)" <gi...@apache.org> on 2026/10/13 03:02:10 UTC
[PR] fix: stop watcher without publishing a shutdown message [casbin-redis-watcher]
CodingCaius opened a new pull request, #62:
URL: https://github.com/apache/casbin-redis-watcher/pull/62
Closing a watcher currently broadcasts the plain-text payload `Close` on the policy channel, causing other watchers to report JSON parsing errors during normal shutdown.
Select on the local close signal alongside incoming Redis messages so an idle receiver can exit without a Redis wake-up message. Keep the existing deferred resource cleanup and stop check before processing a received message, and make repeated `Close()` calls safe with `sync.Once`.
The regression tests use an independent Redis subscriber to verify that shutdown publishes no message, the idle subscription and owned clients are released, and a surviving watcher still publishes and receives normal updates. A second test covers concurrent repeated closes.
Fixes #61.
### Validation
- The new broadcast regression fails on unmodified master with `Close published a non-JSON message: "Close"`.
- `go test -mod=readonly -covermode atomic -coverprofile=covprofile ./...` — passed, 78.9% statement coverage.
- `go test -mod=readonly -race -run '^TestWatcherClose' -count=10 ./...` — passed.
- `golangci-lint run ./...` — 0 issues.
- Tested locally with Go 1.26.2 and Redis 7.2 in a loopback-only test container. The patch uses APIs available in the project's Go 1.23 baseline.
--
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: commits-unsubscribe@casbin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org
Re: [PR] fix: stop watcher without publishing a shutdown message [casbin-redis-watcher]
Posted by "hsluoyz (via GitHub)" <gi...@apache.org>.
hsluoyz merged PR #62:
URL: https://github.com/apache/casbin-redis-watcher/pull/62
--
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: commits-unsubscribe@casbin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org
Re: [PR] fix: stop watcher without publishing a shutdown message [casbin-redis-watcher]
Posted by "CodingCaius (via GitHub)" <gi...@apache.org>.
CodingCaius commented on PR #62:
URL: https://github.com/apache/casbin-redis-watcher/pull/62#issuecomment-6236632271
Thanks for re-running the checks. The lint job fails during golangci-lint config verify, before analyzing the Go code.
The run uses v2.15.0, which renamed exhaustive.check’s map value to mapliteral. The repository’s existing configuration still uses map and is unchanged by this PR. Updating that entry should resolve the configuration error; the actual lint checks would still need to run afterward.
The Go 1.23 test job passed. For transparency, my local lint validation used v2.12.2, so it did not cover the newer configuration schema.
--
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: commits-unsubscribe@casbin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org