mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-24 15:41:55 +08:00
fix: fix the error of database is locked when use sqlite (#60)
This commit is contained in:
@@ -44,6 +44,13 @@ func NewRecord(rule *Rule, flag, method, url, ip, area, raw string) (r *Record,
|
||||
RawRequest: raw,
|
||||
Rule: *rule,
|
||||
}
|
||||
|
||||
// sqlite db-level lock to prevent too much write operation lead to error of `database is locked` #54
|
||||
if database.Driver == database.Sqlite {
|
||||
database.Locker.Lock()
|
||||
defer database.Locker.Unlock()
|
||||
}
|
||||
|
||||
return r, database.DB.Create(r).Error
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user