Skip to content

Commit

Permalink
Merge pull request #4621 from activepieces/fix/queue
Browse files Browse the repository at this point in the history
fix: queue fix
  • Loading branch information
abuaboud committed May 3, 2024
2 parents 2aa3900 + 95267a4 commit 4ff6dbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/pieces/community/queue/package.json
@@ -1,4 +1,4 @@
{
"name": "@activepieces/piece-queue",
"version": "0.0.1"
"version": "0.0.2"
}
Expand Up @@ -28,16 +28,16 @@ export const pushToQueue = createAction({
}),
},
async run(context) {
await push({ store: context.store, queueName: context.propsValue.queueName, items: context.propsValue.items, testing: false })
return push({ store: context.store, queueName: context.propsValue.queueName, items: context.propsValue.items, testing: false })
},
async test(context) {
await push({ store: context.store, queueName: context.propsValue.queueName, items: context.propsValue.items, testing: true })
return push({ store: context.store, queueName: context.propsValue.queueName, items: context.propsValue.items, testing: true })
}
});

async function push({ store, queueName, items, testing }: { store: Store, queueName: string, items: unknown[], testing: boolean }) {
const key = constructQueueName(queueName, testing)
const existingQueueItems = await store.get(queueName, StoreScope.PROJECT) || []
const updatedQueueItems = [...existingQueueItems as unknown[], ...items]
const existingQueueItems = await store.get<unknown[]>(key, StoreScope.PROJECT) || []
const updatedQueueItems = [...existingQueueItems, ...items]
await store.put(key, updatedQueueItems, StoreScope.PROJECT)
}

0 comments on commit 4ff6dbb

Please sign in to comment.