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

View file

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

View file

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