Skip to content

Commit eacf167

Browse files
release lock writer early
1 parent 5025c1a commit eacf167

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

db/multi_database.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ func (r *MultiDatabaseRepository) Write(ctx context.Context, url string, resp *R
7272
var cr Repository
7373
if resp.DatabaseID == -1 {
7474
r.muWriter.Lock()
75-
defer r.muWriter.Unlock()
7675
r.currentWriter++
7776
if r.currentWriter >= len(r.concurrentRepositories) {
7877
r.currentWriter = 0
7978
}
8079
cr = r.concurrentRepositories[r.currentWriter]
80+
r.muWriter.Unlock()
8181
} else {
8282
cr = r.concurrentRepositories[resp.DatabaseID]
8383
}

0 commit comments

Comments
 (0)