Skip to content

Commit

Permalink
Re-added global interaction timeout to prevent issues with race condi…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
lcb01a committed Aug 16, 2024
1 parent 540a55b commit bca5f58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vrphone.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, config: Config, gui: Gui, osc_client):
self.menu = Menu(config=self.config, gui=self.gui, osc_client=self.osc_client, microsip=self.microsip)
self.osc_queue: set = set()
self.microsip_queue: set = set()
self.last_interactions: dict = dict()
self.last_interaction = time.time() - self.config.get_by_key("interaction_timeout")
self.is_paused = False
self.avatar_change_input = params.avatar_change
self.osc_bool_inputs: dict[str, tuple] = {
Expand Down Expand Up @@ -70,7 +70,7 @@ def osc_collision(self, address: str, *args):
return
if not self.is_paused:
if address in self.osc_bool_inputs:
if address in self.last_interactions and (self.last_interactions[address] + self.config.get_by_key("interaction_timeout")) > time.time():
if self.last_interaction + self.config.get_by_key("interaction_timeout") > time.time():
return
if len(args) != 1:
return
Expand All @@ -79,7 +79,7 @@ def osc_collision(self, address: str, *args):
return
if was_entered and address not in self.osc_queue:
self.osc_queue.add(address)
self.last_interactions[address] = time.time()
self.last_interaction = time.time()

def microsip_callback(self, command: str, caller: str):
self.microsip_queue.add((command, caller))
Expand Down

0 comments on commit bca5f58

Please sign in to comment.