Skip to content

Commit 6b6aa23

Browse files
committed
Create bucket only on load
1 parent 3742e23 commit 6b6aa23

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

aw-watcher-sublime.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def sync_settings() -> None:
5353
heartbeat_frequency = SETTINGS.get("heartbeat_frequency")
5454
api.setup(CLIENT_ID, hostname, port, heartbeat_frequency)
5555

56+
bucket_name = SETTINGS.get("bucket_name")
57+
api.ensure_bucket(bucket_name)
58+
5659

5760
def toggle_debugging(enable: bool) -> None:
5861
if enable:
@@ -105,9 +108,7 @@ def correct_slashes(path):
105108
def handle_activity(view):
106109
if DEBUG:
107110
utils.log("handle_activity() fired")
108-
if CONNECTED:
109-
api.ensure_bucket(SETTINGS.get("bucket_name"))
110-
else:
111+
if not CONNECTED:
111112
active_window = sublime.active_window()
112113
if active_window:
113114
for view in active_window.views():
@@ -125,7 +126,8 @@ def handle_activity(view):
125126
event_data["file"],
126127
event_data["project"],
127128
event_data["language"]))
128-
api.heartbeat(SETTINGS.get("bucket_name"), event_data)
129+
bucket_name = SETTINGS.get("bucket_name")
130+
api.heartbeat(bucket_name, event_data)
129131

130132

131133
class ActivityWatchListener(sublime_plugin.EventListener):

0 commit comments

Comments
 (0)