mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
Don't fail to register for tokens when upstreams are offline
This commit is contained in:
parent
087d15eeaa
commit
d36436eca4
@ -72,6 +72,10 @@ export class ScalarService {
|
||||
|
||||
const upstreams = await Upstream.findAll();
|
||||
await Promise.all(upstreams.map(async upstream => {
|
||||
if (!await ScalarStore.isUpstreamOnline(upstream)) {
|
||||
LogService.warn("ScalarService", `Skipping registration for ${mxUserId} on upstream ${upstream.id} (${upstream.name}) because it is offline`);
|
||||
return null;
|
||||
}
|
||||
const tokens = await UserScalarToken.findAll({where: {userId: mxUserId, upstreamId: upstream.id}});
|
||||
if (!tokens || tokens.length === 0) {
|
||||
LogService.info("ScalarService", "Registering " + mxUserId + " for a token at upstream " + upstream.id + " (" + upstream.name + ")");
|
||||
@ -84,7 +88,7 @@ export class ScalarService {
|
||||
upstreamId: upstream.id,
|
||||
});
|
||||
}
|
||||
}));
|
||||
}).filter(token => !!token));
|
||||
|
||||
const dimensionToken = randomString({length: 25});
|
||||
const dimensionScalarToken = await UserScalarToken.create({
|
||||
|
Loading…
Reference in New Issue
Block a user