Skip to content

Commit

Permalink
fixup! Add support for sending updates from the GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWrigley committed Apr 4, 2024
1 parent a5088d1 commit fbced4c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions damnit/gui/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ def run_values_updated(self, proposal, run, name, value):
}
})

# Note: the send() function returns a future that we don't await. This
# is potentially dangerous, but the reason is because it would cause a
# delay in the GUI and because people don't usually close the GUI
# immediately after editing a variable so it's unlikely that the process
# will die before the update is sent (as happened with the backend).
# Note: the send() function returns a future that we don't await
# immediately, but we call kafka_prd.flush() in stop() which will ensure
# that all messages are sent.
self.kafka_prd.send(self.update_topic, message)

def variable_set(self, name, title, description, variable_type):
Expand All @@ -71,6 +69,7 @@ def variable_set(self, name, title, description, variable_type):

def stop(self):
self.running = False
self.kafka_prd.flush(timeout=10)


if __name__ == "__main__":
Expand Down

0 comments on commit fbced4c

Please sign in to comment.