Open grigori-gru opened 5 years ago
Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.
The this context is different between decorator and function, not use this in decorator
Thanks, but how should I use it in this case?
That's all about @Cron
params of course. For example if I want to test how my schedule job works using less period, I can't do it.
I have the same question, I want to set enable: true/false based on the environment parameters.
Environment parameters can be used directly, since they are available already. However it's not possible to use a service in decorators. I ended up creating tasks manually. However, there are no helper functions for distributed locking there.
I have to create static methods and properties in ConfigService, then we can access them.
@Timeout(1000, {
key: ConfigService.getString('ABC_KEY'),
enable: ConfigService.getBoolean('ABC_ENABLE'),
})
Not sure if this is the best practice
Is it possible to set time to decorator from configService which I use as dependency in my job module, for example this way: