question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

End-of-game timing information is inconsistent with event timestamps

See original GitHub issue

When a game is ended, the final timer value (games/${gameId}/endedAt) is usually 5-50ms higher than the timestamp of the last game event (gameData/${gameId}/events/${eventId}/time). This is because the client takes an extra round-trip to finalize that a game has finished.

Example

In the image below, the last event has timestamp 02:35.52, but the final timer stops at 02:35.55. There’s a delay of around 30ms after the last set, before the game actually ends, and the database is updated.

image

Fixing

One solution involves adding an HTTPS-callable serverless function to end the game, which when called, checks if the game is actually finished (and that the user is authenticated), then sets the endedAt key to be the time of the last valid event, rather than simply the current time. This would resolve the visible discrepancy in timestamps.

This is a good opportunity to learn about serverless functions, realtime database permissions, and Set with Friends’s architecture. Please contact me if interested.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
chrismolina159commented, Oct 10, 2020

admin_needed

It seems I need additional perms to be able to deploy any functions. Let me know if this seems feasible or if something else is causing this error!

0reactions
chrismolina159commented, Oct 14, 2020

Created a PR let me know if there is anything wrong/that you want changed!

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript event timestamps not consistent - Stack Overflow
As defined in standard timeStamp returns number of milliseconds since epoch: Used to specify the time (in milliseconds relative to the epoch) at...
Read more >
Why is date_hour inconsistent with %H? - Splunk Community
Solved: According to doco: "The date_hour field ... is extracted from the event's timestamp (the value in _time)." Consider this test:
Read more >
Viewing online file analysis results for 'LeagueClient.exe'
LeagueClient.exe. This report is generated from a file or URL submitted to this webservice on December 6th 2018 19:27:09 (UTC) and action script...
Read more >
Jenny Feng. Real‐Time Event Summarization of Esports ...
Real Time Event Summarization (RTS). RTS is a text‐retrieval track that focuses on the process of recognizing and harvesting useful information from ...
Read more >
Photon Unity Networking | Page 29
Hi, Going through a crisis. The crisis is, my game is intended to run in enterprise network where we can't enable ports locally...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found