Skip to content

Commit

Permalink
Fix: Use default ttl for synchronization (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
RikudouSage authored Feb 10, 2024
1 parent b2c24a2 commit bd56042
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export class FilterFormComponent<TSettings extends SynchronizationSettings> impl
return [...censures, ...hesitations];
})();
this.cache[`endorsed:${myInstance}`] ??= await (async () => {
const response = await toPromise(this.cachedApi.getEndorsementsByInstances([myInstance], {ttl: 5}));
const response = await toPromise(this.cachedApi.getEndorsementsByInstances([myInstance]));
if (this.apiResponseHelper.handleErrors([response])) {
return [];
}
Expand Down Expand Up @@ -339,7 +339,7 @@ export class FilterFormComponent<TSettings extends SynchronizationSettings> impl
}

private async getCensuresByInstances(instances: string[]): Promise<InstanceDetailResponse[] | null> {
const instancesResponse = await toPromise(this.cachedApi.getAllCensuresByInstances(instances, {ttl: 5}));
const instancesResponse = await toPromise(this.cachedApi.getAllCensuresByInstances(instances));
if (this.apiResponseHelper.handleErrors([instancesResponse])) {
return null;
}
Expand All @@ -348,7 +348,7 @@ export class FilterFormComponent<TSettings extends SynchronizationSettings> impl
}

private async getHesitationsByInstances(instances: string[]): Promise<InstanceDetailResponse[] | null> {
const instancesResponse = await toPromise(this.cachedApi.getAllHesitationsByInstances(instances, {ttl: 5}));
const instancesResponse = await toPromise(this.cachedApi.getAllHesitationsByInstances(instances));
if (this.apiResponseHelper.handleErrors([instancesResponse])) {
return null;
}
Expand All @@ -357,7 +357,7 @@ export class FilterFormComponent<TSettings extends SynchronizationSettings> impl
}

private async getEndorsedCensureChain(instance: string): Promise<string[]> {
return await toPromise(this.cachedApi.getEndorsementsByInstances([instance], {ttl: 5}).pipe(
return await toPromise(this.cachedApi.getEndorsementsByInstances([instance]).pipe(
map(response => {
if (this.apiResponseHelper.handleErrors([response])) {
return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class SynchronizeLemmyComponent implements OnInit {

const myCensures = await toPromise(this.cachedFediseerApi.getAllCensuresByInstances([
this.authManager.currentInstanceSnapshot.name,
], {ttl: 10}));
]));
if (this.apiResponseHelper.handleErrors([myCensures])) {
return;
}
Expand Down Expand Up @@ -251,7 +251,7 @@ export class SynchronizeLemmyComponent implements OnInit {

this.cachedFediseerApi.getAllCensuresByInstances(
[this.authManager.currentInstanceSnapshot.name],
{clear: true, ttl: 10},
{clear: true},
).subscribe(response => {
if (!response.success) {
this.messageService.createWarning(`Couldn't fetch new list of your censured instances, please reload the page to get fresh data.`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class SynchronizeMastodonComponent implements OnInit {

const myCensures = await toPromise(this.cachedFediseerApi.getAllCensuresByInstances([
this.authManager.currentInstanceSnapshot.name,
], {ttl: 10}));
]));
if (this.apiResponseHelper.handleErrors([myCensures])) {
return;
}
Expand Down Expand Up @@ -312,7 +312,7 @@ export class SynchronizeMastodonComponent implements OnInit {

this.cachedFediseerApi.getAllCensuresByInstances(
[this.authManager.currentInstanceSnapshot.name],
{clear: true, ttl: 10},
{clear: true},
).subscribe(response => {
if (!response.success) {
this.messageService.createWarning(`Couldn't fetch new list of your censured instances, please reload the page to get fresh data.`);
Expand Down

0 comments on commit bd56042

Please sign in to comment.