Skip to content

Commit

Permalink
Merge branch 'release/v0.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
slaveofcode committed Oct 23, 2022
2 parents c7e499b + 1531b79 commit 1be1e3b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

### v0.1.4

> 23 October 2022
- Handle sqlite lock serialization

### v0.1.3

> 23 October 2022
Expand Down
22 changes: 15 additions & 7 deletions routes/files/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,21 @@ func Upload(repo repository.Repository) func(c *gin.Context) {
for {
err = saveFileMeta()
// TODO: Need better recognition for handling serialize transaction error
serializeErrStr := "ERROR: could not serialize access due to concurrent update (SQLSTATE 40001)"
if err != nil && err.Error() != serializeErrStr {
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{
"success": false,
"message": "Unable to process the file:" + err.Error(),
})
return
serializeErrMsgs := []string{
"ERROR: could not serialize access due to concurrent update (SQLSTATE 40001)",
"database is locked (5) (SQLITE_BUSY)",
}

if err != nil {
for _, msg := range serializeErrMsgs {
if err.Error() != msg {
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{
"success": false,
"message": "Unable to process the file:" + err.Error(),
})
return
}
}
}

if err != nil {
Expand Down

0 comments on commit 1be1e3b

Please sign in to comment.