dsh-feishu-bot 0.19.9 → 0.19.10

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/cli.js CHANGED
@@ -4693,7 +4693,7 @@ async function fetchNpmLatestVersion(packageName, registryUrl = defaultRegistryU
4693
4693
  }
4694
4694
  return void 0;
4695
4695
  }
4696
- async function fetchNpmLatestVersionOnce(packageName, registryUrl = defaultRegistryUrl(), timeoutMs = 5e3, fetcher = fetch) {
4696
+ async function fetchNpmLatestVersionOnce(packageName, registryUrl = defaultRegistryUrl(), timeoutMs = NPM_LATEST_TIMEOUT_MS, fetcher = fetch) {
4697
4697
  try {
4698
4698
  const response = await fetcher(
4699
4699
  `${registryUrl}/${encodeURIComponent(packageName)}/latest`,
@@ -10879,6 +10879,7 @@ async function reply6(ctx, zh, en) {
10879
10879
  // src/upgrade/update-check.ts
10880
10880
  init_own_package();
10881
10881
  var UPDATE_CHECK_CACHE_MS = 60 * 6e4;
10882
+ var UPDATE_CHECK_FAILURE_CACHE_MS = 15e3;
10882
10883
  var cache;
10883
10884
  function upgradeCheckEnabled() {
10884
10885
  return (process.env.DSH_LARK_UPGRADE_CHECK ?? "1") !== "0";
@@ -10894,16 +10895,22 @@ function isNewer(latest, current) {
10894
10895
  async function latestVersion(options = {}) {
10895
10896
  if (!upgradeCheckEnabled()) return void 0;
10896
10897
  const now = Date.now();
10897
- if (cache !== void 0 && now - cache.at < (options.cacheMs ?? UPDATE_CHECK_CACHE_MS)) {
10898
- return cache.latest;
10898
+ if (cache !== void 0) {
10899
+ const ttl = options.cacheMs !== void 0 ? options.cacheMs : cache.failed ? UPDATE_CHECK_FAILURE_CACHE_MS : UPDATE_CHECK_CACHE_MS;
10900
+ if (now - cache.at < ttl) return cache.latest;
10899
10901
  }
10900
10902
  const probe = options.probe ?? fetchNpmLatestVersionOnce;
10901
10903
  const latest = await probe(options.packageName ?? ownPackageInfo().name);
10902
- cache = { at: now, latest, notified: cache?.notified ?? /* @__PURE__ */ new Set() };
10904
+ cache = {
10905
+ at: now,
10906
+ latest,
10907
+ failed: latest === void 0,
10908
+ notified: cache?.notified ?? /* @__PURE__ */ new Set()
10909
+ };
10903
10910
  return latest;
10904
10911
  }
10905
10912
  function markNotified(latest) {
10906
- if (cache === void 0) cache = { at: 0, latest, notified: /* @__PURE__ */ new Set() };
10913
+ if (cache === void 0) cache = { at: 0, latest, failed: false, notified: /* @__PURE__ */ new Set() };
10907
10914
  if (cache.notified.has(latest)) return false;
10908
10915
  cache.notified.add(latest);
10909
10916
  return true;