A social RSS reader built on the AT Protocol. glean.at
glean atproto atmosphere rss feed social app
14
fork

Configure Feed

Select the types of activity you want to include in your feed.

Enable WAL for all dbs

+31 -3
+31 -3
internal/db/db.go
··· 11 11 "github.com/mattn/go-sqlite3" 12 12 ) 13 13 14 - const DSN = "_journal_mode=WAL&_busy_timeout=30000&_synchronous=NORMAL&_cache=shared" 15 - 16 14 type DB struct { 17 15 *sql.DB 18 16 } ··· 42 40 return err 43 41 } 44 42 for _, p := range []string{ 43 + `PRAGMA journal_mode=WAL`, 45 44 `PRAGMA wal_autocheckpoint = 1000`, 45 + `PRAGMA busy_timeout = 30000`, 46 + `PRAGMA synchronous = NORMAL`, 47 + `PRAGMA cache = shared`, 46 48 `PRAGMA temp_store = MEMORY`, 47 49 `PRAGMA mmap_size = 268435456`, 48 50 } { ··· 53 55 if _, err := conn.Exec(fmt.Sprintf("ATTACH DATABASE '%s' AS articles", articlesPath), nil); err != nil { 54 56 return err 55 57 } 58 + for _, p := range []string{ 59 + `PRAGMA articles.journal_mode=WAL`, 60 + `PRAGMA articles.wal_autocheckpoint = 1000`, 61 + `PRAGMA articles.busy_timeout = 30000`, 62 + `PRAGMA articles.synchronous = NORMAL`, 63 + `PRAGMA articles.cache = shared`, 64 + `PRAGMA articles.temp_store = MEMORY`, 65 + `PRAGMA articles.mmap_size = 268435456`, 66 + } { 67 + if _, err := conn.Exec(p, nil); err != nil { 68 + return err 69 + } 70 + } 56 71 if _, err := conn.Exec(fmt.Sprintf("ATTACH DATABASE '%s' AS recs", recsPath), nil); err != nil { 57 72 return err 58 73 } 74 + for _, p := range []string{ 75 + `PRAGMA recs.journal_mode=WAL`, 76 + `PRAGMA recs.wal_autocheckpoint = 1000`, 77 + `PRAGMA recs.busy_timeout = 30000`, 78 + `PRAGMA recs.synchronous = NORMAL`, 79 + `PRAGMA recs.cache = shared`, 80 + `PRAGMA recs.temp_store = MEMORY`, 81 + `PRAGMA recs.mmap_size = 268435456`, 82 + } { 83 + if _, err := conn.Exec(p, nil); err != nil { 84 + return err 85 + } 86 + } 59 87 return nil 60 88 }, 61 89 }) 62 90 63 - db, err := sql.Open(driverName, basePath+"_users?cache=shared&"+DSN) 91 + db, err := sql.Open(driverName, basePath+"_users") 64 92 if err != nil { 65 93 return nil, err 66 94 }