abler-api 0.1.43 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/pp-util.js +6 -6
- package/package.json +1 -1
package/dist/cjs/pp-util.js
CHANGED
|
@@ -1786,12 +1786,6 @@ class schedule$1 {
|
|
|
1786
1786
|
*/
|
|
1787
1787
|
|
|
1788
1788
|
static async registerTask(taskName, taskCaption, cronExp, taskFunc, autoStart) {
|
|
1789
|
-
if (!conf) {
|
|
1790
|
-
ppUtil$1.configNeeded();
|
|
1791
|
-
conf = ppUtil$1.appConfig;
|
|
1792
|
-
err = ppUtil$1.appErrCfg;
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
1789
|
if (!this.envAllowed()) return {};
|
|
1796
1790
|
let task = this.findTask(taskName);
|
|
1797
1791
|
|
|
@@ -2020,6 +2014,12 @@ class schedule$1 {
|
|
|
2020
2014
|
|
|
2021
2015
|
|
|
2022
2016
|
static envAllowed() {
|
|
2017
|
+
if (!conf) {
|
|
2018
|
+
ppUtil$1.configNeeded();
|
|
2019
|
+
conf = ppUtil$1.appConfig;
|
|
2020
|
+
err = ppUtil$1.appErrCfg;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
2023
|
let enabled = // PM2配置中指定了环境变量 SCHEDULE_ENABLED
|
|
2024
2024
|
!!process.env.SCHEDULE_ENABLED // 如果PM2启动了多个进程,则只在第一个进程执行
|
|
2025
2025
|
&& process.env.NODE_APP_INSTANCE === '0'; // 如果有多台服务器,则只在第一台执行
|