mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-08 16:14:30 +00:00
Merge pull request '[v8.0/forgejo] [BUG] Make logout event non-blocking' (#4981) from bp-v8.0/forgejo-9c5c088 into v8.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4981 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
commit
9d2ea1ef5d
|
@ -77,13 +77,3 @@ func (m *Manager) SendMessage(uid int64, message *Event) {
|
|||
messenger.SendMessage(message)
|
||||
}
|
||||
}
|
||||
|
||||
// SendMessageBlocking sends a message to a particular user
|
||||
func (m *Manager) SendMessageBlocking(uid int64, message *Event) {
|
||||
m.mutex.Lock()
|
||||
messenger, ok := m.messengers[uid]
|
||||
m.mutex.Unlock()
|
||||
if ok {
|
||||
messenger.SendMessageBlocking(message)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,12 +66,3 @@ func (m *Messenger) SendMessage(message *Event) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SendMessageBlocking sends the message to all registered channels and ensures it gets sent
|
||||
func (m *Messenger) SendMessageBlocking(message *Event) {
|
||||
m.mutex.Lock()
|
||||
defer m.mutex.Unlock()
|
||||
for i := range m.channels {
|
||||
m.channels[i] <- message
|
||||
}
|
||||
}
|
||||
|
|
|
@ -408,7 +408,7 @@ func HandleSignOut(ctx *context.Context) {
|
|||
// SignOut sign out from login status
|
||||
func SignOut(ctx *context.Context) {
|
||||
if ctx.Doer != nil {
|
||||
eventsource.GetManager().SendMessageBlocking(ctx.Doer.ID, &eventsource.Event{
|
||||
eventsource.GetManager().SendMessage(ctx.Doer.ID, &eventsource.Event{
|
||||
Name: "logout",
|
||||
Data: ctx.Session.ID(),
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue