Skip to content

Commit 9a5b213

Browse files
committed
Add an argument to skip snapshoting.
This helps at the moment, as long is encoding in roc is hard
1 parent 5fe6336 commit 9a5b213

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

host/main.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type cliConfig struct {
2929
Addr string `help:"Address to listen on." default:":8090"`
3030
SnapshotFile string `help:"Path to the snapshot file." default:"db.snapshot" type:"path"`
3131
RequestsFile string `help:"Path to the requests file." default:"db.requests" type:"path"`
32+
NoSnapshot bool `help:"Disable snapshoting."`
3233
}
3334

3435
func run(cli cliConfig) (err error) {
@@ -55,11 +56,13 @@ func run(cli cliConfig) (err error) {
5556
return fmt.Errorf("initial roc app: %w", err)
5657
}
5758

58-
defer func() {
59-
if sErr := db.SnapshotWrite(r.DumpModel()); sErr != nil {
60-
err = errors.Join(err, fmt.Errorf("saving model snapshot: %w", sErr))
61-
}
62-
}()
59+
if !cli.NoSnapshot {
60+
defer func() {
61+
if sErr := db.SnapshotWrite(r.DumpModel()); sErr != nil {
62+
err = errors.Join(err, fmt.Errorf("saving model snapshot: %w", sErr))
63+
}
64+
}()
65+
}
6366

6467
return http.Run(ctx, cli.Addr, r, db)
6568
}

0 commit comments

Comments
 (0)