mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 18:13:41 -05:00
Revert "Attempt new headless sync implementation"
This reverts commit 05ccf81e57
.
This commit is contained in:
parent
05ccf81e57
commit
11f6cb9d0e
2 changed files with 20 additions and 15 deletions
|
@ -1,6 +1,7 @@
|
||||||
package headless
|
package headless
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
@ -67,17 +68,25 @@ func Init(conf Config, updates chan fmt.Stringer) error {
|
||||||
|
|
||||||
// sync
|
// sync
|
||||||
updates <- beginningSync{}
|
updates <- beginningSync{}
|
||||||
|
resp, err := gmx.Matrix().Client().FullSyncRequest(mautrix.ReqSync{
|
||||||
|
Timeout: 30000,
|
||||||
|
Since: "",
|
||||||
|
FilterID: "",
|
||||||
|
FullState: true,
|
||||||
|
SetPresence: gmx.Matrix().Client().SyncPresence,
|
||||||
|
Context: context.Background(),
|
||||||
|
StreamResponse: true,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
updates <- fetchedSyncData{}
|
||||||
|
|
||||||
gmx.Matrix().(*matrix.Container).InitSyncer()
|
gmx.Matrix().(*matrix.Container).InitSyncer()
|
||||||
syncloop:
|
updates <- processingSync{}
|
||||||
for {
|
err = gmx.Matrix().(*matrix.Container).ProcessSyncResponse(resp, "")
|
||||||
select {
|
if err != nil {
|
||||||
case <-gmx.Matrix().(*matrix.Container).StopChannel():
|
return err
|
||||||
break syncloop
|
|
||||||
default:
|
|
||||||
if err := gmx.Matrix().Client().Sync(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
updates <- syncFinished{}
|
updates <- syncFinished{}
|
||||||
|
|
||||||
|
|
|
@ -350,10 +350,6 @@ func (c *Container) Logout() {
|
||||||
c.ui.OnLogout()
|
c.ui.OnLogout()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Container) StopChannel() chan bool {
|
|
||||||
return c.stop
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop stops the Matrix syncer.
|
// Stop stops the Matrix syncer.
|
||||||
func (c *Container) Stop() {
|
func (c *Container) Stop() {
|
||||||
if c.running {
|
if c.running {
|
||||||
|
@ -473,7 +469,7 @@ func (c *Container) InitSyncer() {
|
||||||
}
|
}
|
||||||
if c.headless {
|
if c.headless {
|
||||||
c.syncer.FirstDoneCallback = func() {
|
c.syncer.FirstDoneCallback = func() {
|
||||||
c.stop <- true
|
c.Stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue