Skip to content

Commit 449aed7

Browse files
committed
handled some more PR feedback
1 parent f913b30 commit 449aed7

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

server/utils/atproto/utils/likes.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,17 @@ export class PackageLikesUtils {
149149
const subjectRef = PACKAGE_SUBJECT_REF(packageName)
150150

151151
const splitAtUri = atUri.replace('at://', '').split('/')
152-
const backLink = {
152+
const collection = splitAtUri[1]
153+
const rkey = splitAtUri[2]
154+
155+
if (!collection || !rkey) {
156+
throw new Error(`Invalid atUri given: ${atUri}`)
157+
}
158+
const backLink: Backlink = {
153159
did: usersDid,
154-
collection: splitAtUri[1],
155-
rkey: splitAtUri[2],
156-
} as Backlink
160+
collection,
161+
rkey,
162+
}
157163

158164
// We store the backlink incase a user is liking and unlikign rapidly. constellation takes a few seconds to capture the backlink
159165
const usersBackLinkKey = CACHE_USERS_BACK_LINK(packageName, usersDid)

server/utils/cache/adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ export function getCacheAdatper(prefix: string): CacheAdapter {
1010
})
1111
return new RedisCacheAdatper(redis, prefix)
1212
}
13-
return new StorageCacheAdapter()
13+
return new LocalCacheAdapter()
1414
}

server/utils/cache/local.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function isCacheEntryStale(entry: LocalCachedEntry): boolean {
2222
/**
2323
* Local implmentation of a cache to be used during development
2424
*/
25-
export class StorageCacheAdapter implements CacheAdapter {
25+
export class LocalCacheAdapter implements CacheAdapter {
2626
private readonly storage = useStorage('generic-cache')
2727

2828
async get<T>(key: string): Promise<T | undefined> {

0 commit comments

Comments
 (0)