abler-api 0.1.42 → 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.
Files changed (2) hide show
  1. package/dist/cjs/pp-util.js +11 -11
  2. package/package.json +1 -1
@@ -653,17 +653,17 @@ class apiUtil$2 {
653
653
  tokenData.certPublicKey = req.certPublicKey;
654
654
  }
655
655
 
656
- kvStorage.storeObj(token, tokenData, timeout);
656
+ await kvStorage.storeObj(token, tokenData, timeout);
657
657
 
658
658
  if (dataId) {
659
- kvStorage.restoreValue("token_" + dataId).then(function (oldToken) {
659
+ await kvStorage.restoreValue("token_" + dataId).then(async oldToken => {
660
660
  if (oldToken !== token) {
661
- kvStorage.unstoreValue(oldToken);
661
+ await kvStorage.unstoreValue(oldToken);
662
662
  } else {
663
663
  dataId = "";
664
664
  }
665
- }, function (e) {}).then(() => {
666
- if (dataId !== "") kvStorage.storeValue("token_" + dataId, token, timeout);
665
+ }, function (e) {}).then(async () => {
666
+ if (dataId !== "") await kvStorage.storeValue("token_" + dataId, token, timeout);
667
667
  });
668
668
  }
669
669
  }
@@ -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'; // 如果有多台服务器,则只在第一台执行
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abler-api",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "description": "API服务相关工具",
5
5
  "main": "./dist/cjs/pp-util.js",
6
6
  "-module": "./dist/es/pp-util.js",