Created
September 11, 2016 17:13
-
-
Save abelaska/19ef5c38cf6fb49db5661e29ae819c7b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
await UserSession.get(ctx.id).update({ pingedAt: r.now() }, { durability: 'soft' }); | |
} catch (e) { | |
if (e.name === 'DocumentNotFoundError') { | |
await UserSession | |
.insert({ id: ctx.id, userId: ctx.user.id, pingedAt: r.now() }, { durability: 'soft' }); | |
} else { | |
log.error(`Failed to update user session ${ctx.id}`, { | |
error: err | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment