douyanqu9722 2017-07-24 06:08
浏览 22
已采纳

将数据库的结果延迟25分钟

I'm new here and pretty much an eclectic coder at best so plz be gentle!

Data from a poker tournament is updated in realtime to a database, but we delay the video feed by 20-25 minutes because graphics (i.e. RFID card reader results, etc.) would result in viewers seeing things that players at the table themselves do not - like, everyone elses cards!

That's all handled by proprietary software called PokerGFX, so that part is fine.

But I would like to retrieve the data in the database (seperate from PokerGFX) at the same interval of delay as the video stream to implement a bot with Twitch API so people in Twitch chat can get relevent info like a particular players chip count, but what their chip count was 25 minutes ago, not the realtime data.

I can access the db with MySQL, php and use JS or whatever else is needed. It seems I'm wanting exactly opposite of what everyone else needs...SLOWER data retrieval, not persistent or FASTER LOL!

Thanks for any insight into this.

UPDATE: o but wait there's more: Things have changed, here's what I have:

SELECT * FROM table1 WHERE CurrTime > NOW() - INTERVAL 1 HOUR LIMIT 1";

is giving less than accurate results +- 2 minutes, so I need the most recent record at least 1 hour old. I have tried all kinds of things, interestingly enough, every google result brings me right back here! All of this data loads into an html that auto refreshes every 10 seconds, and I'm finding that if the database is not updated every 60 seconds or so, the html requesting the data goes blank.

  • 写回答

1条回答 默认 最新

  • dongquechan4414 2017-07-24 06:14
    关注

    You could store a snapshot of the data in an intermediary database. Retrieve it in real-time, timestamp it and then display the data from the older snapshot (25mins ago). Also, depending on the structure of the original database you may be able to achieve this with only the original database.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 opencv 无法读取视频
  • ¥15 用matlab 实现通信仿真
  • ¥15 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档