mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-13 23:20:50 +01:00
Merge branch 'io' into merge-upstream
This commit is contained in:
commit
f85b80f376
1 changed files with 3 additions and 3 deletions
|
@ -52,13 +52,13 @@ export class FetchInstanceMetadataService {
|
|||
|
||||
@bindThis
|
||||
public async tryLock(host: string): Promise<boolean> {
|
||||
const mutex = await this.redisClient.set(`fetchInstanceMetadata:mutex:${host}`, '1', 'GET');
|
||||
const mutex = await this.redisClient.set(`fetchInstanceMetadata:mutex:${host}`, '1', 'EX', 60 * 5, 'NX', 'GET');
|
||||
return mutex !== '1';
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public unlock(host: string): Promise<'OK'> {
|
||||
return this.redisClient.set(`fetchInstanceMetadata:mutex:${host}`, '0');
|
||||
public unlock(host: string): Promise<number> {
|
||||
return this.redisClient.del(`fetchInstanceMetadata:mutex:${host}`);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
Loading…
Reference in a new issue