Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Fix flow issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Whale committed Apr 4, 2018
1 parent 0fd7483 commit 0815fea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion athena/models/usersThreads.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const getThreadNotificationUsers = (
export const getUsersThread = (
userId: string,
threadId: string
): Promise<DBUsersThreads> => {
): Promise<?DBUsersThreads> => {
return db
.table('usersThreads')
.getAll(userId, { index: 'userId' })
Expand Down
6 changes: 2 additions & 4 deletions athena/queues/track-user-thread-last-seen.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@ export default async (job: Job<UserThreadLastSeenJobData>) => {
).toString()}`
);

const record = await getUsersThread(userId, threadId);
const record: ?DBUsersThreads = await getUsersThread(userId, threadId);

if (record) {
if (
record.lastSeen &&
new Date(record.lastSeen).getTime() > new Date(date).getTime()
) {
debug(
`old lastSeen ${
record.lastSeen
} is later than new lastSeen ${date.toString()}, not running job:\nuserId: ${userId}\nthreadId: ${threadId}\ntimestamp: ${new Date(
`old lastSeen ${record.lastSeen.toString()} is later than new lastSeen ${date.toString()}, not running job:\nuserId: ${userId}\nthreadId: ${threadId}\ntimestamp: ${new Date(
timestamp
).toString()}`
);
Expand Down

0 comments on commit 0815fea

Please sign in to comment.