refactor main, and fix bugs from initial manual run

Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2025-01-13 15:45:07 -08:00
parent 55f9725af1
commit fed49ba3cb
6 changed files with 66 additions and 35 deletions

View file

@ -259,7 +259,7 @@ func (e ConfessionsChannelLinkEvent) Data() map[string]string {
}
func (e ConfessionsChannelLinkEvent) Validate() error {
if len(e.ChannelID) > 1 || len(e.GuildID) > 1 {
if len(e.ChannelID) <= 1 || len(e.GuildID) <= 1 {
return errors.New(BadConfessionsLinkEventError)
}

View file

@ -159,6 +159,7 @@ func Start() error {
// return no error. we are handling SIGINT
func Teardown() {
logging.Warn("Tearing down state engine")
// riskily ignore all locking....
// we are handling a termination signal after all
i, e := eventStream.Close()
@ -167,6 +168,7 @@ func Teardown() {
logging.Warn("will attempt to truncate event store anyways")
}
logging.Warn("teardown: events flushed")
e = os.Truncate(eventStorageFileName, i)
if e != nil {
logging.Error("FAILED TO TRUNCATE EVENT STORE!!")