fix various bugs

This commit is contained in:
mpostma 2021-03-12 00:37:43 +01:00
parent 7d9637861f
commit e4d45b0500
No known key found for this signature in database
GPG key ID: CBC8A7C1D7A28C3A
7 changed files with 27 additions and 65 deletions

View file

@ -131,7 +131,16 @@ impl IndexController {
pub async fn update_settings(&self, uid: String, settings: Settings, create: bool) -> anyhow::Result<UpdateStatus> {
let uuid = if create {
self.uuid_resolver.get_or_create(uid).await?
let uuid = self.uuid_resolver.get_or_create(uid).await?;
// We need to create the index upfront, since it would otherwise only be created when
// the update is processed. This would make calls to GET index to fail until the update
// is complete. Since this is get or create, we ignore the error when the index already
// exists.
match self.index_handle.create_index(uuid.clone(), None).await {
Ok(_) | Err(index_actor::IndexError::IndexAlreadyExists) => (),
Err(e) => return Err(e.into()),
}
uuid
} else {
self.uuid_resolver.resolve(uid).await?
};