mirror of
https://github.com/enso-org/enso.git
synced 2024-08-16 16:30:33 +03:00
Improve SuggestionsRepo initialization (#9808)
Added synchronization block to avoid race conditions.
This commit is contained in:
parent
c67218c1ed
commit
ff28737252
@ -24,9 +24,13 @@ class InMemorySuggestionsRepo(implicit ec: ExecutionContext)
|
||||
override def init: Future[Unit] = {
|
||||
Future {
|
||||
if (db == null) {
|
||||
db = new mutable.HashMap()
|
||||
version = 0
|
||||
index = 1
|
||||
this.synchronized {
|
||||
if (db == null) {
|
||||
db = new mutable.HashMap()
|
||||
version = 0
|
||||
index = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user