bunnyquery 1.0.0 → 1.0.2

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/bunnyquery.js +12 -1
  2. package/package.json +1 -1
package/bunnyquery.js CHANGED
@@ -569,7 +569,7 @@
569
569
  async _bootstrap() {
570
570
  // 1. Validate that the project has a configured AI platform.
571
571
  if (!this.platform) {
572
- this._renderFatal('This project does not have an AI agent configured yet. Set one in your project settings.');
572
+ this._renderFatal('This project does not have an AI agent configured yet. Please ask the project owner to set up an AI agent in the project settings page.');
573
573
  return;
574
574
  }
575
575
 
@@ -1089,7 +1089,17 @@
1089
1089
  _schedulePendingPoll() {
1090
1090
  if (this.pendingTimer) clearTimeout(this.pendingTimer);
1091
1091
  if (!this._anyPending()) return;
1092
+ // Bail if a poll is already in flight — its `finally` will
1093
+ // schedule the next one. Without this guard, any caller that
1094
+ // fires while we're awaiting `getChatHistory` (e.g. another
1095
+ // _sendMessage, _loadFirstHistoryPage, or our own previous
1096
+ // tick whose timer already elapsed) would spawn a second
1097
+ // concurrent poller, and each subsequent cycle would compound
1098
+ // — making the polling appear faster and faster.
1099
+ if (this._pollingPending) return;
1092
1100
  this.pendingTimer = setTimeout(async () => {
1101
+ this.pendingTimer = null;
1102
+ this._pollingPending = true;
1093
1103
  try {
1094
1104
  const res = await getChatHistory(
1095
1105
  this.skapi,
@@ -1110,6 +1120,7 @@
1110
1120
  } catch (err) {
1111
1121
  console.error('[BunnyQuery] pending poll failed', err);
1112
1122
  } finally {
1123
+ this._pollingPending = false;
1113
1124
  this._schedulePendingPoll();
1114
1125
  }
1115
1126
  }, DEFAULTS.PENDING_POLL_INTERVAL_MS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunnyquery",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "BunnyQuery AI chat client",
5
5
  "main": "bunnyquery.js",
6
6
  "files": [