Add reset API in Dashboard
This commit is contained in:
1 parent
2d98ea2d17
commit
7db25bf19b
3 files changed
+34
No files matched your search
@@ -194,8 +194,20 @@ class BatchStore:
|
||||
self.ignore_batch_label = False
|
||||
self.log('Ignore batch label cooldown finished')
|
||||
|
||||
def _check_reset_signal(self):
|
||||
reset_file = Path(str(self.state_file) + ".reset")
|
||||
if reset_file.exists():
|
||||
reset_file.unlink(missing_ok=True)
|
||||
if self.current_state is not None:
|
||||
self.log("External reset signal — clearing in-memory state")
|
||||
self.current_state = None
|
||||
if self.batch_timer:
|
||||
self.batch_timer.cancel()
|
||||
self.batch_timer = None
|
||||
|
||||
def record_ayam_crossing(self, track_id):
|
||||
"""Line-cross equivalent of production ayam-potong MQTT event."""
|
||||
self._check_reset_signal()
|
||||
with self.state_lock:
|
||||
counting_date = self.get_counting_date()
|
||||
started_new = False
|
||||
@@ -223,6 +235,7 @@ class BatchStore:
|
||||
|
||||
def record_talenan_crossing(self, track_id):
|
||||
"""Line-cross equivalent of production telenan MQTT batch close."""
|
||||
self._check_reset_signal()
|
||||
if self.ignore_batch_label:
|
||||
return False
|
||||
with self.state_lock:
|
||||
|
||||
Reference in new issue
Block a user