mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-06-30 05:44:28 +02:00
fix: Failing open on database errors
oops
This commit is contained in:
parent
eb2e3b3bb7
commit
d8a27eeb54
1 changed files with 15 additions and 3 deletions
|
@ -1,11 +1,11 @@
|
||||||
use std::{collections::BTreeMap, mem, sync::Arc};
|
use std::{collections::BTreeMap, mem, sync::Arc};
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Error, Result, Server, at, debug_warn, err, trace,
|
Err, Error, Result, Server, at, debug_warn, err, result, trace,
|
||||||
utils::{self, ReadyExt, TryFutureExtExt, stream::TryIgnore, string::Unquoted},
|
utils::{self, ReadyExt, TryFutureExtExt, stream::TryIgnore, string::Unquoted},
|
||||||
};
|
};
|
||||||
use database::{Deserialized, Ignore, Interfix, Json, Map};
|
use database::{Deserialized, Ignore, Interfix, Json, Map};
|
||||||
use futures::{Stream, StreamExt, TryFutureExt};
|
use futures::{Stream, StreamExt, TryFutureExt, TryStreamExt};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
DeviceId, KeyId, MilliSecondsSinceUnixEpoch, OneTimeKeyAlgorithm, OneTimeKeyId,
|
DeviceId, KeyId, MilliSecondsSinceUnixEpoch, OneTimeKeyAlgorithm, OneTimeKeyId,
|
||||||
OneTimeKeyName, OwnedDeviceId, OwnedKeyId, OwnedMxcUri, OwnedUserId, RoomId, UInt, UserId,
|
OneTimeKeyName, OwnedDeviceId, OwnedKeyId, OwnedMxcUri, OwnedUserId, RoomId, UInt, UserId,
|
||||||
|
@ -176,7 +176,19 @@ impl Service {
|
||||||
self.db
|
self.db
|
||||||
.userid_suspended
|
.userid_suspended
|
||||||
.get(user_id)
|
.get(user_id)
|
||||||
.map_ok_or(Ok(false), |_| Ok(true))
|
.map_ok_or_else(
|
||||||
|
|err| {
|
||||||
|
if err.is_not_found() {
|
||||||
|
Ok(false)
|
||||||
|
} else {
|
||||||
|
err!(Database(error!(
|
||||||
|
"Failed to check if user {user_id} is suspended: {err}"
|
||||||
|
)));
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|_| Ok(true),
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue