mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-18 15:25:41 +00:00
f54f877f27
* Remove special-case method for new memberships only, use more generic method * Only collect profiles from state events in public rooms * Add a table to track stale remote user profiles * Add store methods to set and delete rows in this new table * Mark remote profiles as stale when a member state event comes in to a private room * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> * Simplify by removing Optionality of `event_id` * Replace names and avatars with None if they're set to dodgy things I think this makes more sense anyway. * Move schema delta to 74 (I missed the boat?) * Turns out these can be None after all --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
40 lines
1.7 KiB
SQL
40 lines
1.7 KiB
SQL
/* Copyright 2022 The Matrix.org Foundation C.I.C
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
-- Table containing a list of remote users whose profiles may have changed
|
|
-- since their last update in the user directory.
|
|
CREATE TABLE user_directory_stale_remote_users (
|
|
-- The User ID of the remote user whose profile may be stale.
|
|
user_id TEXT NOT NULL PRIMARY KEY,
|
|
|
|
-- The server name of the user.
|
|
user_server_name TEXT NOT NULL,
|
|
|
|
-- The timestamp (in ms) after which we should next try to request the user's
|
|
-- latest profile.
|
|
next_try_at_ts BIGINT NOT NULL,
|
|
|
|
-- The number of retries so far.
|
|
-- 0 means we have not yet attempted to refresh the profile.
|
|
-- Used for calculating exponential backoff.
|
|
retry_counter INTEGER NOT NULL
|
|
);
|
|
|
|
-- Create an index so we can easily query upcoming servers to try.
|
|
CREATE INDEX user_directory_stale_remote_users_next_try_idx ON user_directory_stale_remote_users(next_try_at_ts, user_server_name);
|
|
|
|
-- Create an index so we can easily query upcoming users to try for a particular server.
|
|
CREATE INDEX user_directory_stale_remote_users_next_try_by_server_idx ON user_directory_stale_remote_users(user_server_name, next_try_at_ts);
|