File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff 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
3435func 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}
You can’t perform that action at this time.
0 commit comments