seems to save toots to disk now

This commit is contained in:
Jeffrey Paul 2019-12-19 06:42:41 -08:00
parent 983ff9d35e
commit 46e022c731
3 changed files with 7 additions and 3 deletions

View File

@ -456,8 +456,6 @@ func (i *Instance) fetchRecentToots() error {
Msgf("unable to parse recent toot list") Msgf("unable to parse recent toot list")
i.registerError() i.registerError()
i.Event("TOOT_FETCH_ERROR") i.Event("TOOT_FETCH_ERROR")
fmt.Printf(string(body))
return err return err
} }

View File

@ -10,7 +10,7 @@ import "github.com/sneak/feta/toot"
import "github.com/sneak/feta/seeds" import "github.com/sneak/feta/seeds"
import "github.com/sneak/feta/instance" import "github.com/sneak/feta/instance"
const hostDiscoveryParallelism = 20 const hostDiscoveryParallelism = 5
// LogReportInterval defines how long between logging internal // LogReportInterval defines how long between logging internal
// stats/reporting for user supervision // stats/reporting for user supervision

View File

@ -2,6 +2,7 @@ package storage
import "errors" import "errors"
import "io/ioutil" import "io/ioutil"
import "path/filepath"
import "os" import "os"
import "strings" import "strings"
import "sync" import "sync"
@ -63,6 +64,11 @@ func (ts *TootFSStorage) TootExists(t toot.Toot) bool {
func (ts *TootFSStorage) StoreToot(t toot.Toot) error { func (ts *TootFSStorage) StoreToot(t toot.Toot) error {
path := t.DiskStoragePath() path := t.DiskStoragePath()
full := ts.root + "/" + path full := ts.root + "/" + path
dir := filepath.Dir(full)
err := os.MkdirAll(dir, 0755)
if err != nil {
return err
}
return ioutil.WriteFile(full, t.Original, 0644) return ioutil.WriteFile(full, t.Original, 0644)
} }