Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

功能建议:离线补传 #174

Closed
lion-brave opened this issue Aug 16, 2023 · 2 comments
Closed

功能建议:离线补传 #174

lion-brave opened this issue Aug 16, 2023 · 2 comments
Assignees
Labels

Comments

@lion-brave
Copy link
Contributor

背景:网关会经常出现网络不好的情况,比如4G模块,在恶劣条件下,会导致数据无法上传
解决方案:每条数据记录当前时间戳,如果此条数据上报不成功,则存储,等到下个上报周期,如果新数据上报成功后,马上上报存储的失败数据

@wwhai
Copy link
Collaborator

wwhai commented Aug 16, 2023

设计思路

增加一个函数:applib:LocalCache("UUID", data)

local err = applib:DataToUdp("UUID", data)
if err ~=nil then
   applib:LocalCache("UUID", data)
   print("Failed And LocalCache")
else
   print("Success")
end

然后过一段时间恢复以后LocalCache会把数据推到"UUID"所指向的目标。

LocalCache 设计

这个其实不难,用Sqlite即可,每次LocalCache的时候,新建一个表,将数据压入,等恢复以后,再弹出数据,并且删除即可。

@wwhai wwhai added the Feature label Sep 2, 2023
@wwhai
Copy link
Collaborator

wwhai commented May 18, 2024

数据仓库可以解决

@wwhai wwhai closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants