refactor: bind hot_reload event via EventDispatcher, add on_hot_reload to PricingProgram
This commit is contained in:
parent
71329af722
commit
7b9d3d2ba0
BIN
pricing/__pycache__/init.cpython-310.pyc
Normal file
BIN
pricing/__pycache__/init.cpython-310.pyc
Normal file
Binary file not shown.
BIN
pricing/__pycache__/pricing.cpython-310.pyc
Normal file
BIN
pricing/__pycache__/pricing.cpython-310.pyc
Normal file
Binary file not shown.
@ -35,6 +35,9 @@ def load_pricing():
|
|||||||
env.load_pricing_data = PricingProgram.load_pricing_data
|
env.load_pricing_data = PricingProgram.load_pricing_data
|
||||||
env.get_pricing_program = PricingProgram.get_pricing_program
|
env.get_pricing_program = PricingProgram.get_pricing_program
|
||||||
env.test_pricing = test_pricing
|
env.test_pricing = test_pricing
|
||||||
|
# Bind hot_reload event — staticmethod, ref safe (stored on class)
|
||||||
|
if hasattr(env, 'event_dispatcher'):
|
||||||
|
env.event_dispatcher.bind('hot_reload', PricingProgram.on_hot_reload)
|
||||||
dbpools = DBPools()
|
dbpools = DBPools()
|
||||||
dbname = env.get_module_dbname('pricing')
|
dbname = env.get_module_dbname('pricing')
|
||||||
if dbname:
|
if dbname:
|
||||||
|
|||||||
@ -186,6 +186,11 @@ def data_mapping(ns, name, v):
|
|||||||
class PricingProgram:
|
class PricingProgram:
|
||||||
pricing_data = {}
|
pricing_data = {}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def on_hot_reload(data=None):
|
||||||
|
"""Event handler for hot_reload event. Clears pricing cache."""
|
||||||
|
PricingProgram.pricing_data.clear()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def get_pricing_program(ppid):
|
async def get_pricing_program(ppid):
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"widgettype": "VBox",
|
"widgettype": "VBox",
|
||||||
"options": {
|
"options": {
|
||||||
"cheight": 40,
|
"css": "filler", "height": "100%",
|
||||||
"width": "100%"
|
"width": "100%"
|
||||||
},
|
},
|
||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user