diff options
Diffstat (limited to 'blenderkit/search.py')
-rw-r--r-- | blenderkit/search.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/blenderkit/search.py b/blenderkit/search.py index f86a9a5e..3894b020 100644 --- a/blenderkit/search.py +++ b/blenderkit/search.py @@ -117,7 +117,7 @@ def refresh_notifications_timer(): fetch_server_data() all_notifications_count = comments_utils.count_all_notifications() comments_utils.get_notifications_thread(preferences.api_key, all_count = all_notifications_count) - return 300 + return 7200 def update_ad(ad): @@ -197,9 +197,9 @@ def scene_load(context): categories.load_categories() if not bpy.app.timers.is_registered(refresh_token_timer) and not bpy.app.background: bpy.app.timers.register(refresh_token_timer, persistent=True, first_interval=36000) - if utils.experimental_enabled() and not bpy.app.timers.is_registered( - refresh_notifications_timer) and not bpy.app.background: - bpy.app.timers.register(refresh_notifications_timer, persistent=True, first_interval=5) + # if utils.experimental_enabled() and not bpy.app.timers.is_registered( + # refresh_notifications_timer) and not bpy.app.background: + # bpy.app.timers.register(refresh_notifications_timer, persistent=True, first_interval=5) update_assets_data() @@ -218,10 +218,11 @@ def fetch_server_data(): get_profile() if bpy.context.window_manager.get('bkit_categories') is None: categories.fetch_categories_thread(api_key, force=False) - all_notifications_count = comments_utils.count_all_notifications() - comments_utils.get_notifications_thread(api_key, all_count = all_notifications_count) + # all_notifications_count = comments_utils.count_all_notifications() + # comments_utils.get_notifications_thread(api_key, all_count = all_notifications_count) first_time = True +first_search_parsing = True last_clipboard = '' @@ -408,7 +409,7 @@ def search_timer(): all_thumbs_loaded = all_loaded - global search_threads + global search_threads, first_search_parsing if len(search_threads) == 0: # utils.p('end search timer') props = utils.get_search_props() @@ -426,6 +427,15 @@ def search_timer(): # but most of the time only one is running anyway if not thread[0].is_alive(): + #check for notifications only for users that actually use the add-on + if first_search_parsing: + first_search_parsing = False + all_notifications_count = comments_utils.count_all_notifications() + comments_utils.get_notifications_thread(api_key, all_count=all_notifications_count) + if utils.experimental_enabled() and not bpy.app.timers.is_registered( + refresh_notifications_timer) and not bpy.app.background: + bpy.app.timers.register(refresh_notifications_timer, persistent=True, first_interval=5) + search_threads.remove(thread) # icons_dir = thread[1] scene = bpy.context.scene |