fix sqlite db lock by reducing maximum open connections to 1 (#26)

This commit is contained in:
Tiger Wang 2022-12-02 17:14:57 -05:00 committed by GitHub
parent e2f9de8d4c
commit 2acf34b224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -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)