Extensions: Only check for updates on startup every 24 hours #121888

Manually merged
Campbell Barton merged 6 commits from brecht/blender:extensions-check-time into main 2024-05-29 07:07:50 +02:00

To reduce network bandwith and to only bother users once a day with
add-on updates. All repos are checked together so that there is only
one notification per day.

To reduce network bandwith and to only bother users once a day with add-on updates. All repos are checked together so that there is only one notification per day.
Brecht Van Lommel added 2 commits 2024-05-16 19:14:49 +02:00
f5612dc422 Extensions: Only check for updates on startup every 24 hours
To reduce network bandwith and to only bother users once a day with
add-on updates. All repos are checked together so that there is only
one notification per day.
Brecht Van Lommel requested review from Campbell Barton 2024-05-16 19:15:30 +02:00
Brecht Van Lommel requested review from Dalai Felinto 2024-05-16 19:15:30 +02:00
Author
Owner

To test conveniently:

touch -d "25 hours ago" ~/.config/blender/4.2/extensions/blender_org/.blender_ext/index.json
touch -d "23 hours ago" ~/.config/blender/4.2/extensions/blender_org/.blender_ext/index.json
To test conveniently: ``` touch -d "25 hours ago" ~/.config/blender/4.2/extensions/blender_org/.blender_ext/index.json touch -d "23 hours ago" ~/.config/blender/4.2/extensions/blender_org/.blender_ext/index.json ```

Interesting, I think it is reasonable. You would still expect to see the latest listing once you go to the preferences right?

All in all +1, I haven’t tested though

Interesting, I think it is reasonable. You would still expect to see the latest listing once you go to the preferences right? All in all +1, I haven’t tested though

I think we should mention this on the “Check for Updates on Startup” tooltip by the way

I think we should mention this on the “Check for Updates on Startup” tooltip by the way

In short, I'm not against this, some notes below.


The premise of this PR makes me question the functionality, if this is bothering users we could consider making it less intrusive. Possibly show nothing unless updates are available for example.

Also, to avoid too much network traffic, we could have a way to check if the JSON changed since last checking to avoid re-downloading it every time. If the extensions repository becomes very active the chance the list changes between checks increases though. The file could be compressed too.

Anyway, I'm not the target audience for this feature, most applications I prefer manual updates over the command line which Blender can do via: blender -c extension update --sync.


AFAICS the patch can be applied with only minor changes, we can always support configuring this if users want.

In short, I'm not against this, some notes below. ---- The premise of this PR makes me question the functionality, if this is bothering users we could consider making it less intrusive. Possibly show nothing unless updates are available for example. Also, to avoid too much network traffic, we could have a way to check if the JSON changed since last checking to avoid re-downloading it every time. If the extensions repository becomes very active the chance the list changes between checks increases though. The file could be compressed too. Anyway, I'm not the target audience for this feature, most applications I prefer manual updates over the command line which Blender can do via: `blender -c extension update --sync`. ---- AFAICS the patch can be applied with only minor changes, we can always support configuring this if users want.
Campbell Barton reviewed 2024-05-17 06:59:51 +02:00
@ -280,0 +280,4 @@
def repo_index_outdated(directory: str) -> bool:
filepath_json = os.path.join(directory, REPO_LOCAL_JSON)
mtime = file_mtime_or_none(filepath_json)
if mtime == None:

*picly* mtime is None.

\*picly\* `mtime is None`.
brecht marked this conversation as resolved
Campbell Barton reviewed 2024-05-17 07:00:17 +02:00
@ -280,0 +286,4 @@
# Refresh once every 24 hours.
age_in_seconds = time.time() - mtime
max_age_in_seconds = 3600.0 * 24.0
return abs(age_in_seconds) > max_age_in_seconds

I'd assume use of abs(..) here is meant to account for unlikely cases of users setting their clock forward/backwards, to avoid a situation where an update never runs. Worth a comment that this ensures updates if unexpected time-stamps are ever encountered.

I'd assume use of `abs(..)` here is meant to account for unlikely cases of users setting their clock forward/backwards, to avoid a situation where an update never runs. Worth a comment that this ensures updates if unexpected time-stamps are ever encountered.
brecht marked this conversation as resolved
Campbell Barton approved these changes 2024-05-17 07:03:07 +02:00
Dismissed
Campbell Barton left a comment
Owner

Accepting with minor requests.

Accepting with minor requests.
Author
Owner

I realized maybe I need to change this to only download every 24 hours, but still always show if there are updates.

You would still expect to see the latest listing once you go to the preferences right?

Yeah, maybe this needs further changes to always update when opening the extension preferences for the first time in a Blender session.

The premise of this PR makes me question the functionality, if this is bothering users we could consider making it less intrusive. Possibly show nothing unless updates are available for example.

I think making this more subtle or only showing when there are updates would be good regardless.

I also see now that if there is no internet access, it shows the update as having failed. I wouldn't consider that a failure to report to the user. If they are offline this is expected. Even if extensions.blender.org is down for whatever reason, the user does not need to be concerned with that I think.

Also, to avoid too much network traffic, we could have a way to check if the JSON changed since last checking to avoid re-downloading it every time. If the extensions repository becomes very active the chance the list changes between checks increases though. The file could be compressed too.

Maybe it's already using HTTP compression? Not sure if anything would need to be done for that on either end. It would also be possible to have a smaller file for update checks, that only includes blocklist, ids and version.

I'm not sure how much of a practical concern this is.

I realized maybe I need to change this to only download every 24 hours, but still always show if there are updates. > You would still expect to see the latest listing once you go to the preferences right? Yeah, maybe this needs further changes to always update when opening the extension preferences for the first time in a Blender session. > The premise of this PR makes me question the functionality, if this is bothering users we could consider making it less intrusive. Possibly show nothing unless updates are available for example. I think making this more subtle or only showing when there are updates would be good regardless. I also see now that if there is no internet access, it shows the update as having failed. I wouldn't consider that a failure to report to the user. If they are offline this is expected. Even if extensions.blender.org is down for whatever reason, the user does not need to be concerned with that I think. > Also, to avoid too much network traffic, we could have a way to check if the JSON changed since last checking to avoid re-downloading it every time. If the extensions repository becomes very active the chance the list changes between checks increases though. The file could be compressed too. Maybe it's already using HTTP compression? Not sure if anything would need to be done for that on either end. It would also be possible to have a smaller file for update checks, that only includes blocklist, ids and version. I'm not sure how much of a practical concern this is.
Brecht Van Lommel added 1 commit 2024-05-17 16:34:44 +02:00
Brecht Van Lommel changed title from Extensions: Only check for updates on startup every 24 hours to WIP: Extensions: Only check for updates on startup every 24 hours 2024-05-17 17:25:03 +02:00
Brecht Van Lommel force-pushed extensions-check-time from 3c385f3236 to 141eab7455 2024-05-27 18:49:39 +02:00 Compare
Brecht Van Lommel changed title from WIP: Extensions: Only check for updates on startup every 24 hours to Extensions: Only check for updates on startup every 24 hours 2024-05-27 18:54:56 +02:00
Author
Owner

I made it check for updates against the index file every time now, but still only update the index file every 24 hours.

Also tweaked the wording so that it's more clear this will not actually install the updates.

Regarding how prominent to show these messages and failures, I'd like to change that, but in another PR.

I made it check for updates against the index file every time now, but still only update the index file every 24 hours. Also tweaked the wording so that it's more clear this will not actually install the updates. Regarding how prominent to show these messages and failures, I'd like to change that, but in another PR.
Brecht Van Lommel added 1 commit 2024-05-28 18:00:52 +02:00
Brecht Van Lommel requested review from Campbell Barton 2024-05-28 20:26:28 +02:00
Campbell Barton approved these changes 2024-05-29 06:38:29 +02:00
Campbell Barton reviewed 2024-05-29 07:01:47 +02:00
@ -362,2 +376,4 @@
``bpy.ops.ext.repo_sync(directory)``.
"""
if dry_run:
return [COMPLETE_ITEM]

Should be:

yeild [COMPLETE_ITEM]
return

edit, applied & committed as this was the only change needed.

Should be: ``` yeild [COMPLETE_ITEM] return ``` *edit*, applied & committed as this was the only change needed.
brecht marked this conversation as resolved
Campbell Barton manually merged commit 5de8ea74c4 into main 2024-05-29 07:07:50 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#121888
No description provided.