Compare commits

..

No commits in common. "e2b3dc13fb2679d23de1b8c5a450330fbe854159" and "1d1c675dd703d6458d2b00fd164b5b8fa865ece1" have entirely different histories.

View File

@ -6,7 +6,6 @@ import { localCache } from '../services'
import { RelayMap, RelaySet } from '../types' import { RelayMap, RelaySet } from '../types'
import { import {
DEFAULT_LOOK_UP_RELAY_LIST, DEFAULT_LOOK_UP_RELAY_LIST,
ONE_DAY_IN_MS,
ONE_WEEK_IN_MS, ONE_WEEK_IN_MS,
SIGIT_RELAY SIGIT_RELAY
} from './const' } from './const'
@ -57,7 +56,7 @@ const findRelayListInCache = async (hexKey: string): Promise<Event | null> => {
// Check if the cached event is not older than one week // Check if the cached event is not older than one week
if ( if (
cachedRelayListMetadataEvent && cachedRelayListMetadataEvent &&
!isOlderThanOneWeek(cachedRelayListMetadataEvent.cachedAt) isOlderThanOneWeek(cachedRelayListMetadataEvent.cachedAt)
) { ) {
return cachedRelayListMetadataEvent.event return cachedRelayListMetadataEvent.event
} }
@ -89,11 +88,11 @@ const getDefaultRelayMap = (): RelayMap => ({
}) })
const isOlderThanOneWeek = (cachedAt: number) => { const isOlderThanOneWeek = (cachedAt: number) => {
return Date.now() - cachedAt > ONE_WEEK_IN_MS return Date.now() - cachedAt < ONE_WEEK_IN_MS
} }
const isOlderThanOneDay = (cachedAt: number) => { const isOlderThanOneDay = (cachedAt: number) => {
return Date.now() - cachedAt > ONE_DAY_IN_MS return Date.now() - cachedAt < ONE_WEEK_IN_MS
} }
const isRelayTag = (tag: string[]): boolean => tag[0] === 'r' const isRelayTag = (tag: string[]): boolean => tag[0] === 'r'