Break up large key requests into smaller ones

Otherwise we might get stuck on requests exceeding the server side size
limits forever.
pull/1854/head
Nicolas Werner 4 weeks ago
parent 96a07cf7d9
commit f6788ecf1f
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 16
      src/Cache.cpp

@ -5389,6 +5389,22 @@ Cache::markUserKeysOutOfDate(lmdb::txn &txn,
db_.put(txn, user, nlohmann::json(cacheEntry).dump());
query.device_keys[user] = {};
if (query.device_keys.size() >= 32) {
http::client()->query_keys(
query,
[this, sync_token](const mtx::responses::QueryKeys &keys, mtx::http::RequestErr err) {
if (err) {
nhlog::net()->warn("failed to query device keys: {} {}",
err->matrix_error.error,
static_cast<int>(err->status_code));
return;
}
emit userKeysUpdate(sync_token, keys);
});
query.device_keys.clear();
}
}
if (!query.device_keys.empty())

Loading…
Cancel
Save