Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
汉广 committed Jun 24, 2023
1 parent 60ccfa0 commit 31a2c60
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/plugins/jx3/price_goods/lib/trade_v2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import threading
from concurrent.futures.thread import ThreadPoolExecutor
from sgtpyutils.extensions import distinct
import random
Expand Down Expand Up @@ -111,7 +112,7 @@ def get_favoritest_by_predict(predict: callable):
goods.sort(key=lambda x: -x.u_popularity)
return [x for index, x in enumerate(goods) if predict(index, x)]

import threading

class FavoritestGoodsPriceRefreshThread(threading.Thread):
def run(self) -> None:
logger.debug('refresh_favoritest_goods_current_price start')
Expand All @@ -135,7 +136,11 @@ def run_single(a, b):
x.result()
logger.debug('refresh_favoritest_goods_current_price complete')
return super().run()
thread_fav_prices_refresher:FavoritestGoodsPriceRefreshThread = None


thread_fav_prices_refresher: FavoritestGoodsPriceRefreshThread = None


async def refresh_favoritest_goods_current_price():
global thread_fav_prices_refresher
if thread_fav_prices_refresher is None or not thread_fav_prices_refresher.is_alive():
Expand Down

0 comments on commit 31a2c60

Please sign in to comment.