TaiBIF / camera-trap-api

RESTful API
6 stars 3 forks source link

相機鎖定狀態的回收處理 #189

Open ghost opened 5 years ago

ghost commented 5 years ago

從這個 issue 延伸的討論 https://github.com/TaiBIF/camera-trap-vueapp/issues/198

在不使用 websocket 的情況下,使用者若直接關閉編輯中的相機位置視窗,前端來不及送 _unlock request,不知道目前後端有沒有鎖定相機狀態的回收機制?

沒有的話,為了維持 30 分鐘的鎖定自動解除行為,後端可能要針對同一批進入鎖定狀態的相機位置有否 annotation 資料的更新來更新鎖定狀態的計時,在 user 完全沒有動作 30 分鐘在後端清除相機的鎖定狀態。

kelp404 commented 5 years ago

相機的鎖定方式是存鎖定結束時間,然後判斷鎖定結束時間是否大於現在時間,所以會自動解除。 https://github.com/TaiBIF/camera-trap-api/blob/a28f4b6838fd7d89b2a29a2c3b9f1e3592c872b5/src/models/data/camera-location-model.js#L86-L97 https://github.com/TaiBIF/camera-trap-api/blob/a28f4b6838fd7d89b2a29a2c3b9f1e3592c872b5/src/models/data/camera-location-model.js#L115-L121

ghost commented 5 years ago

那再請問,若 user 在前端一直有編輯的操作,這個鎖定結束時間也會更新嗎?

kelp404 commented 5 years ago

那再請問,若 user 在前端一直有編輯的操作,這個鎖定結束時間也會更新嗎?

時間不會往後延。

ghost commented 5 years ago

這樣會否前端還在編輯但後端先自動解除鎖定的情況,然後其它人有可能在同一相機位置進入編輯模式?

kelp404 commented 5 years ago

前端每 10 分鐘再鎖一次呢?

diabloevagto commented 5 years ago

後端自己重置時間,前端目前只有修改 annotation 才會重置