outpost: fix 100% CPU Usage when not connected to websocket
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
aca3a5c458
commit
f6e1bfdfc8
|
@ -213,6 +213,6 @@ class UserViewSet(UsedByMixin, ModelViewSet):
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def filter_queryset(self, queryset):
|
def filter_queryset(self, queryset):
|
||||||
if self.request.user.has_perm("authentik_core.view_group"):
|
if self.request.user.has_perm("authentik_core.view_user"):
|
||||||
return self._filter_queryset_for_list(queryset)
|
return self._filter_queryset_for_list(queryset)
|
||||||
return super().filter_queryset(queryset)
|
return super().filter_queryset(queryset)
|
||||||
|
|
|
@ -71,14 +71,12 @@ func (ac *APIController) Shutdown() {
|
||||||
func (ac *APIController) startWSHandler() {
|
func (ac *APIController) startWSHandler() {
|
||||||
logger := ac.logger.WithField("loop", "ws-handler")
|
logger := ac.logger.WithField("loop", "ws-handler")
|
||||||
for {
|
for {
|
||||||
if !ac.wsConn.IsConnected() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
var wsMsg websocketMessage
|
var wsMsg websocketMessage
|
||||||
err := ac.wsConn.ReadJSON(&wsMsg)
|
err := ac.wsConn.ReadJSON(&wsMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.WithError(err).Warning("ws write error, reconnecting")
|
logger.WithError(err).Warning("ws write error, reconnecting")
|
||||||
ac.wsConn.CloseAndReconnect()
|
ac.wsConn.CloseAndReconnect()
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if wsMsg.Instruction == WebsocketInstructionTriggerUpdate {
|
if wsMsg.Instruction == WebsocketInstructionTriggerUpdate {
|
||||||
|
|
|
@ -32,6 +32,10 @@ slug: "2021.7"
|
||||||
- root: subclass SessionMiddleware to set Secure and SameSite flag depending on context
|
- root: subclass SessionMiddleware to set Secure and SameSite flag depending on context
|
||||||
- web: fix error when showing error message of request
|
- web: fix error when showing error message of request
|
||||||
|
|
||||||
|
## Fixed in 2021.7.1-rc2
|
||||||
|
|
||||||
|
- outpost: fix 100% CPU Usage when not connected to websocket
|
||||||
|
|
||||||
## Upgrading
|
## Upgrading
|
||||||
|
|
||||||
This release does not introduce any new requirements.
|
This release does not introduce any new requirements.
|
||||||
|
|
Reference in New Issue