GODT-1543: Using one buffered event for off and on connection

This commit is contained in:
Jakub
2022-05-17 11:59:14 +02:00
parent 16f9dc43cb
commit 5033e9718c
7 changed files with 30 additions and 22 deletions

View File

@ -102,14 +102,17 @@ func New(
func (u *Users) watchEvents() {
upgradeCh := u.events.ProvideChannel(events.UpgradeApplicationEvent)
internetOnCh := u.events.ProvideChannel(events.InternetOnEvent)
internetConnChangedCh := u.events.ProvideChannel(events.InternetConnChangedEvent)
for {
select {
case <-upgradeCh:
isApplicationOutdated = true
u.closeAllConnections()
case <-internetOnCh:
case stat := <-internetConnChangedCh:
if stat != events.InternetOn {
continue
}
for _, user := range u.users {
if user.store == nil {
if err := user.loadStore(); err != nil {