Skip to content

Commit f239022

Browse files
committed
use monotonic instead of time
1 parent cf48178 commit f239022

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

robotcode/language_server/robotframework/diagnostics/namespace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ async def _import(
11721172

11731173
return result, variables
11741174

1175-
current_time = time.time()
1175+
current_time = time.monotonic()
11761176
self._logger.debug(lambda: f"start imports for {self.document if top_level else source}")
11771177
try:
11781178

@@ -1335,7 +1335,7 @@ async def _import(
13351335
finally:
13361336
self._logger.debug(
13371337
lambda: "end import imports for "
1338-
+ f"{self.document if top_level else source} in {time.time() - current_time}s"
1338+
+ f"{self.document if top_level else source} in {time.monotonic() - current_time}s"
13391339
)
13401340

13411341
async def _import_default_libraries(self, variables: Optional[Dict[str, Any]] = None) -> None:

robotcode/utils/async_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ async def async_lock(lock: threading.RLock) -> AsyncGenerator[None, None]:
396396
start_time = time.monotonic()
397397
locked = lock.acquire(blocking=False)
398398
while not locked:
399-
if time.monotonic() - start_time >= 20:
399+
if time.monotonic() - start_time >= 1800:
400400
raise TimeoutError("Timeout waiting for lock")
401401

402402
await asyncio.sleep(0.001)

robotcode/utils/logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,12 @@ def build_exception_message(exception: BaseException) -> str:
451451
start_time: float = 0
452452
end_time: float = 0
453453
if timed:
454-
start_time = time.time()
454+
start_time = time.monotonic()
455455

456456
result = real_func(*real_args, **wrapper_kwargs)
457457

458458
if timed:
459-
end_time = time.time()
459+
end_time = time.monotonic()
460460

461461
except BaseException as e:
462462
ex = e

scripts/update_doc_links.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ def main() -> None:
2525
re.compile(r"(\!\[.*?\]\()(\.)(/[^\)]*?)(\))"),
2626
rf"""\g<1>{tag_base}\g<3>\g<4>""",
2727
)
28+
replace_in_file(
29+
Path("CHANGELOG.md"),
30+
re.compile(r"(\!\[.*?\]\()(\.)(/[^\)]*?)(\))"),
31+
rf"""\g<1>{tag_base}\g<3>\g<4>""",
32+
)
2833

2934

3035
if __name__ == "__main__":

0 commit comments

Comments
 (0)