Skip to content

Commit

Permalink
feat: replace restart environment variable hash with unix epoch (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein authored Jul 31, 2024
1 parent ddb1bd6 commit 8648f80
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/posit/connect/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import posixpath
import secrets
import time
from posixpath import dirname
from typing import List, Optional, overload

Expand Down Expand Up @@ -213,9 +213,9 @@ def restart(self) -> None:
self.update()

if self.is_interactive:
random_hash = secrets.token_hex(32)
key = f"_CONNECT_RESTART_TMP_{random_hash}"
self.environment_variables.create(key, random_hash)
unix_epoch_in_seconds = str(int(time.time()))
key = f"_CONNECT_RESTART_TMP_{unix_epoch_in_seconds}"
self.environment_variables.create(key, unix_epoch_in_seconds)
self.environment_variables.delete(key)
# GET via the base Connect URL to force create a new worker thread.
url = posixpath.join(dirname(self.url), f"content/{self.guid}")
Expand Down

0 comments on commit 8648f80

Please sign in to comment.