Skip to content

Commit

Permalink
fix sqlite db lock by reducing maximum open connections to 1 (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerinus authored Dec 2, 2022
1 parent e2f9de8 commit 2acf34b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sqlite/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func GetDb(dbPath string) *gorm.DB {

c, _ := db.DB()
c.SetMaxIdleConns(10)
c.SetMaxOpenConns(100)
c.SetMaxOpenConns(1)
c.SetConnMaxIdleTime(time.Second * 1000)

gdb = db
Expand Down
1 change: 1 addition & 0 deletions route/v2/api_route_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func (s *UserService) GetEvents(ctx echo.Context, params codegen.GetEventsParams
list := service.MyService.Event().GetEvents()
return ctx.JSON(http.StatusOK, list)
}

func (s *UserService) DeleteEventBySerial(ctx echo.Context, serial codegen.Serial) error {
service.MyService.Event().DeleteEventBySerial(serial)
return ctx.JSON(http.StatusOK, serial)
Expand Down

0 comments on commit 2acf34b

Please sign in to comment.