Skip to content

Commit 1be1e3b

Browse files
committedOct 23, 2022
Merge branch 'release/v0.1.4'
2 parents c7e499b + 1531b79 commit 1be1e3b

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed
 

‎CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
### v0.1.4
6+
7+
> 23 October 2022
8+
9+
- Handle sqlite lock serialization
10+
511
### v0.1.3
612

713
> 23 October 2022

‎routes/files/upload.go

+15-7
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,21 @@ func Upload(repo repository.Repository) func(c *gin.Context) {
8888
for {
8989
err = saveFileMeta()
9090
// TODO: Need better recognition for handling serialize transaction error
91-
serializeErrStr := "ERROR: could not serialize access due to concurrent update (SQLSTATE 40001)"
92-
if err != nil && err.Error() != serializeErrStr {
93-
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{
94-
"success": false,
95-
"message": "Unable to process the file:" + err.Error(),
96-
})
97-
return
91+
serializeErrMsgs := []string{
92+
"ERROR: could not serialize access due to concurrent update (SQLSTATE 40001)",
93+
"database is locked (5) (SQLITE_BUSY)",
94+
}
95+
96+
if err != nil {
97+
for _, msg := range serializeErrMsgs {
98+
if err.Error() != msg {
99+
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{
100+
"success": false,
101+
"message": "Unable to process the file:" + err.Error(),
102+
})
103+
return
104+
}
105+
}
98106
}
99107

100108
if err != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.