Revert sync changes

This reverts commits:
  948bf767bc
  8fcbdddc62
This commit is contained in:
FIGBERT 2023-08-25 13:19:02 -07:00
parent ad1fd015cb
commit 58b212913c
No known key found for this signature in database
GPG key ID: 67F1598D607A844B
3 changed files with 33 additions and 11 deletions

View file

@ -1,6 +1,7 @@
package headless package headless
import ( import (
"context"
"errors" "errors"
"fmt" "fmt"
"os" "os"
@ -66,10 +67,24 @@ func Init(conf Config, updates chan fmt.Stringer) error {
updates <- configuredDisplayMode{} updates <- configuredDisplayMode{}
// sync // sync
updates <- creatingSyncer{} 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()
updates <- synchronizing{} updates <- processingSync{}
err = gmx.Matrix().Client().Sync() err = gmx.Matrix().(*matrix.Container).ProcessSyncResponse(resp, "")
if err != nil { if err != nil {
return err return err
} }

View file

@ -32,16 +32,22 @@ func (msg configuredDisplayMode) String() string {
return "Configured display mode…" return "Configured display mode…"
} }
type creatingSyncer struct{} type beginningSync struct{}
func (msg creatingSyncer) String() string { func (msg beginningSync) String() string {
return "Initializing sync utilities…" return "Beginning the sync process…"
} }
type synchronizing struct{} type fetchedSyncData struct{}
func (msg synchronizing) String() string { func (msg fetchedSyncData) String() string {
return "Synchronizing…" return "Fetched sync data…"
}
type processingSync struct{}
func (msg processingSync) String() string {
return "Processing sync response…"
} }
type syncFinished struct{} type syncFinished struct{}

View file

@ -464,8 +464,9 @@ func (c *Container) InitSyncer() {
debug.Print("Running GC") debug.Print("Running GC")
runtime.GC() runtime.GC()
dbg.FreeOSMemory() dbg.FreeOSMemory()
}
if c.headless { if c.headless {
c.syncer.FirstDoneCallback = func() {
c.Stop() c.Stop()
} }
} }