caobo171 / node-zklib

This is a lightweight of node.js module to connect to biometrix attendance device for examples ZKTeco
70 stars 59 forks source link

getAttendances() is not consistent #6

Closed emahuni closed 4 years ago

emahuni commented 4 years ago

It seems like the data that is returned by getAttendances is not consistent. If you run it multiple times you should notice that the data that is being returned is not the same, nor is the randomness entailing any meaning at all. It seems like there is some race condition happening when reading the data from the device, which is causing it to truncate the read stream or something.

I sometimes get 22 records and sometimes 5, then sometimes 4 records; all this is without any new attendances done.

Any idea why?

emahuni commented 4 years ago

This bug sometimes goes away. Let me try to see how it started or what cozes it and I will update.

caobo171 commented 4 years ago

yeah , can you give me your total records in your device, I 've already faced this issue when data is too large , if it's not , something must be wrong

mementototem commented 4 years ago

I think, when data is big, or slow connection, TIMEOUT (from setTimeout()) is fire, left some chunks behind.

emahuni commented 4 years ago

@caobo171 There wasn't much in the device when this happened, about 40 recs in total... I haven't seen the issue in a long time now.

emahuni commented 4 years ago

I think I reset the device to default settings, which clears everything up, at some point if I am not mistaken, can someone try doing that and see if that was the solution to this issue. If so then this must internal device issues.

caobo171 commented 4 years ago

@mementototem @emahuni recently I fixed some issue about lost data, sometimes it's not need to requestChunk data , data is returned right in requestData() functions, please update the latest version and try again

Michel0305 commented 4 years ago

Hello big coffee, I would like to ask, how do I register for real-time events? I executed it with a command (zkInstance.executeCmd (500, ‘’)) and nothing happened. I want to get real-time feedback from the device, such as user ’s card swipe, user authentication, etc. . . .

mementototem commented 4 years ago

@Michel0305 , you can use

zkInstance.getRealTimeLogs((data) => {
  console.log(data) // your data you want will pop up here
})
Michel0305 commented 4 years ago

TKS It did what I expected

At 2020-03-07 13:56:58, "Apichart Nakarungutti" notifications@github.com wrote:

@Michel0305 , you can use

zkInstance.getRealTimeLogs((data) => { console.log(data) // your data you want will pop up here })

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

csulit commented 4 years ago

@mementototem device model?

mawaridbackend commented 4 months ago

@Michel0305 , you can use

zkInstance.getRealTimeLogs((data) => {
  console.log(data) // your data you want will pop up here
})

zkInstance.getRealTimeLogs((data) => { console.log(data) // your data you want will pop up here }) its not working ?