How to see that a scheduled task is started manually, but not by the timer in nopcommerce -
in nopcommerce scheduled task started timer, have possibility start manually.
is possible in make distinction in code, whether task started timer or started manually?
in case want task run on saterdays because large batchjob:
if (datetime.now.dayofweek != dayofweek.saturday) { return; // don't task }
but start , run manually if situation demands it.
bool startedmanually = _some_magic_here_please; // <- here? if (datetime.now.dayofweek != dayofweek.saturday && !startedmanually) { return; // don't task }
it not supported without source code modification, furthermore taskmanager , taskthread classes not implement interface , not registered via ioc container cannot make required changes without changes in nop.services project, there no posibility add-on or extension.
you can workaround duplicating task, can keep task weekdays constraints enabled in scheluder , other task no weekdays constraints disabled (just manual execution). disabled task can launched administration
it not cleanest solution requires little bit changes inheriting 1 task implementation another.
Comments
Post a Comment