Conversation
This is done by going inside the browser container:
1) copy the browser history file (to avoid locked access)
2) get the most recent `last_visit_time`
Note that the browser history file is just a regular SQLite database.
Chromium stores the timestamp in microseconds since 1601-01-01 00:00:00 UTC,
hence a conversion is necessary to get the usual Unix epochs (in seconds).
To verify, run `uv run chromefleet.py` as usual, start a browser, and query it.
Before:
```json
{"ip_address":"100.70.213.14",
"cdp_url":"http://100.70.213.14:9222"}
```
After:
```json
{"ip_address":"100.70.213.14",
"cdp_url":"http://100.70.213.14:9222",
"last_activity_timestamp":1769470996.638466}
```
Contributor
Author
|
Note that this depends on SQLite on the browser containers: |
bin-ario
approved these changes
Jan 27, 2026
bin-ario
reviewed
Jan 27, 2026
|
|
||
| async def get_container_last_activity(container_name: str) -> float | None: | ||
| try: | ||
| run_podman(["exec", container_name, "sh", "-c", "cp $HOME/chrome-profile/Default/History db"]) |
There was a problem hiding this comment.
is copy necessary or can we just query the History file directly?
Contributor
Author
There was a problem hiding this comment.
When Chromium is still running, it will lock write access to that file (because sqlite3 will want to read and write).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is done by going inside the browser container:
last_visit_timeNote that the browser history file is just a regular SQLite database.
Chromium stores the timestamp in microseconds since 1601-01-01 00:00:00 UTC, hence a conversion is necessary to get the usual Unix epochs (in seconds).
To verify, run
uv run chromefleet.pyas usual, start a browser, and query it.Before:
{"ip_address":"100.70.213.14", "cdp_url":"http://100.70.213.14:9222"}After:
{"ip_address":"100.70.213.14", "cdp_url":"http://100.70.213.14:9222", "last_activity_timestamp":1769470996.638466}