Compare commits

...

3 Commits

Author SHA1 Message Date
Renovate Bot
f4244cfbb5 chore(deps): update https://github.com/cloudflare/wrangler-action digest to 9acf94a 2026-04-16 05:03:19 +00:00
Sebastian Spaeth
bf6783cb83 ci: add all possible credentials
When running the mirror-images step from within the release-image workflow
we receive error messages such as

> msg="Failed to sync" target=ghcr.io/continuwuity/continuwuity:v0.5.0-rc.7
> source=forgejo.ellis.link/continuwuation/continuwuity:v0.5.0-rc.7
> error="failed to send blob post, ref
> ghcr.io/continuwuity/continuwuity@sha256:74976f7b85018b5abd867333bc783c7230d985a4b0af595bbf55964e25afe6ef:
> unauthorized"

So, we will need to define our credentials in the release-image workflow too
it seems, when we pull in the mirror-image workflow.
This is a test by adding all credentials that are defined in mirror-images.yml
Probably we don't need them all, but if this does not work, the whole approach
is flawed and we can remove everyting again.

If it works, we should remove unneccessary credentials until we found the
required ones.
2026-04-15 19:34:33 +00:00
éźera
2ca7149a7f feat: allow deprioritizing servers for join requests
Implements #1549.
2026-04-15 13:24:42 +00:00
7 changed files with 103 additions and 3 deletions

View File

@@ -56,7 +56,7 @@ jobs:
- name: Deploy to Cloudflare Pages (Production)
if: github.ref == 'refs/heads/main' && vars.CLOUDFLARE_PROJECT_NAME != ''
uses: https://github.com/cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3
uses: https://github.com/cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
@@ -64,7 +64,7 @@ jobs:
- name: Deploy to Cloudflare Pages (Preview)
if: github.ref != 'refs/heads/main' && vars.CLOUDFLARE_PROJECT_NAME != ''
uses: https://github.com/cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3
uses: https://github.com/cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}

View File

@@ -121,7 +121,7 @@ jobs:
- name: 🚀 Deploy to Cloudflare Pages
if: vars.CLOUDFLARE_PROJECT_NAME != ''
id: deploy
uses: https://github.com/cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3
uses: https://github.com/cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}

View File

@@ -205,4 +205,15 @@ jobs:
needs:
- merge-maxperf
- merge-release
env:
BUILTIN_REGISTRY_USER: ${{ vars.BUILTIN_REGISTRY_USER }}
BUILTIN_REGISTRY_PASSWORD: ${{ secrets.BUILTIN_REGISTRY_PASSWORD }}
GITLAB_USERNAME: ${{ vars.GITLAB_USERNAME }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
N7574_GIT_USERNAME: ${{ vars.N7574_GIT_USERNAME }}
N7574_GIT_TOKEN: ${{ secrets.N7574_GIT_TOKEN }}
GH_PACKAGES_USER: ${{ vars.GH_PACKAGES_USER }}
GH_PACKAGES_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
DOCKER_MIRROR_USER: ${{ vars.DOCKER_MIRROR_USER }}
DOCKER_MIRROR_TOKEN: ${{ secrets.DOCKER_MIRROR_TOKEN }}
uses: ./.forgejo/workflows/mirror-images.yml

1
changelog.d/1624.feature Normal file
View File

@@ -0,0 +1 @@
Implemented option to deprioritize servers for room join requests. Contributed by @ezera.

View File

@@ -1409,6 +1409,20 @@
#
#ignore_messages_from_server_names = []
# List of server names that continuwuity will deprioritize (try last) when
# a client requests to join a room.
#
# This can be used to potentially speed up room join requests, by
# deprioritizing sending join requests through servers that are known to
# be large or slow.
#
# continuwuity will still send join requests to servers in this list if
# the room couldn't be joined via other servers it federates with.
#
# example: ["example.com"]
#
#deprioritize_joins_through_servers = []
# Send messages from users that the user has ignored to the client.
#
# There is no way for clients to receive messages sent while a user was

View File

@@ -113,6 +113,7 @@ pub(crate) async fn join_room_by_id_route(
servers.sort_unstable();
servers.dedup();
shuffle(&mut servers);
let servers = deprioritize(servers, &services.config.deprioritize_joins_through_servers);
join_room_by_id_helper(
&services,
@@ -241,6 +242,7 @@ pub(crate) async fn join_room_by_id_or_alias_route(
},
};
let servers = deprioritize(servers, &services.config.deprioritize_joins_through_servers);
let join_room_response = join_room_by_id_helper(
&services,
sender_user,
@@ -890,3 +892,59 @@ async fn make_join_request(
info!("All {} servers were unable to assist in joining {room_id} :(", servers.len());
Err!(BadServerResponse("No server available to assist in joining."))
}
/// Moves deprioritized servers (if any) to the back of the list.
///
/// No-op if we aren't given any servers to deprioritize.
fn deprioritize(
servers: Vec<OwnedServerName>,
deprioritized: &[OwnedServerName],
) -> Vec<OwnedServerName> {
if deprioritized.is_empty() {
return servers;
}
let (mut depr, mut servers): (Vec<_>, Vec<_>) =
servers.into_iter().partition(|s| deprioritized.contains(s));
servers.append(&mut depr);
servers
}
#[cfg(test)]
mod tests {
use ruma::OwnedServerName;
use super::*;
#[test]
fn deprioritizing_servers_works() -> Result<(), Box<dyn std::error::Error>> {
let servers = vec![
"example.com".try_into()?,
"slow.invalid".try_into()?,
"example.org".try_into()?,
];
let depr = vec!["slow.invalid".try_into()?];
let expected: Vec<OwnedServerName> = vec![
"example.com".try_into()?,
"example.org".try_into()?,
"slow.invalid".try_into()?,
];
let servers = deprioritize(servers, &depr);
assert_eq!(servers, expected);
Ok(())
}
#[test]
fn empty_deprioritized_is_noop() -> Result<(), Box<dyn std::error::Error>> {
let servers = vec![
"example.com".try_into()?,
"slow.invalid".try_into()?,
"example.org".try_into()?,
];
let depr_servers = deprioritize(servers.clone(), &[]);
assert_eq!(depr_servers, servers);
Ok(())
}
}

View File

@@ -1630,6 +1630,22 @@ pub struct Config {
#[serde(default, with = "serde_regex")]
pub ignore_messages_from_server_names: RegexSet,
/// List of server names that continuwuity will deprioritize (try last) when
/// a client requests to join a room.
///
/// This can be used to potentially speed up room join requests, by
/// deprioritizing sending join requests through servers that are known to
/// be large or slow.
///
/// continuwuity will still send join requests to servers in this list if
/// the room couldn't be joined via other servers it federates with.
///
/// example: ["example.com"]
///
/// default: []
#[serde(default = "Vec::new")]
pub deprioritize_joins_through_servers: Vec<OwnedServerName>,
/// Send messages from users that the user has ignored to the client.
///
/// There is no way for clients to receive messages sent while a user was