@base44-preview/cli 0.3.2-pr.696.333538e → 0.3.2-pr.696.5fe6f82

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/index.js CHANGED
@@ -256820,20 +256820,30 @@ var Actor = class _Actor extends Server {
256820
256820
  handlePlatformEvent(_event) {
256821
256821
  }
256822
256822
  takenPlatformEvents = [];
256823
+ platformEventsInFlight = /* @__PURE__ */ new Map();
256823
256824
  static REMEMBERED_PLATFORM_EVENTS = 64;
256824
256825
  // Called by the generated wrapper for a verified POST .../events; never user-facing.
256825
256826
  async _b44PlatformEvent(request) {
256826
256827
  const room = request.headers.get("x-partykit-room");
256827
256828
  if (room) await this.setName(room);
256828
256829
  const event = await request.json();
256829
- if (!this.takenPlatformEvents.includes(event.event_id)) {
256830
- await this.handlePlatformEvent(event);
256831
- this.takenPlatformEvents.push(event.event_id);
256832
- if (this.takenPlatformEvents.length > _Actor.REMEMBERED_PLATFORM_EVENTS) this.takenPlatformEvents.shift();
256833
- await this.maintainTicker();
256830
+ const eventId = event.event_id;
256831
+ if (!this.takenPlatformEvents.includes(eventId)) {
256832
+ let delivery = this.platformEventsInFlight.get(eventId);
256833
+ if (!delivery) {
256834
+ delivery = this.takePlatformEvent(event).finally(() => this.platformEventsInFlight.delete(eventId));
256835
+ this.platformEventsInFlight.set(eventId, delivery);
256836
+ }
256837
+ await delivery;
256834
256838
  }
256835
256839
  return new Response(null, { status: 204 });
256836
256840
  }
256841
+ async takePlatformEvent(event) {
256842
+ await this.handlePlatformEvent(event);
256843
+ this.takenPlatformEvents.push(event.event_id);
256844
+ if (this.takenPlatformEvents.length > _Actor.REMEMBERED_PLATFORM_EVENTS) this.takenPlatformEvents.shift();
256845
+ await this.maintainTicker();
256846
+ }
256837
256847
  async schedule(key, at) {
256838
256848
  const when = typeof at === "number" ? at : at.getTime();
256839
256849
  await this.mutateSchedules((m) => {
@@ -275204,4 +275214,4 @@ export {
275204
275214
  runCLI
275205
275215
  };
275206
275216
 
275207
- //# debugId=C927D843652FACCF64756E2164756E21
275217
+ //# debugId=7E489688E672E06C64756E2164756E21