Fork me on GitHub
#keechma
<
2022-08-03
>
xlfe11:08:55

I'm scratching my head a bit on using keechma-pipelines with a use-existing queue. The context is as follows. I have a pipeline which gets a "bucket" of data from a remote server. Each bucket has multiple entities worth of data. So one pipeline function :ensure-data is called with the entity required. If there are two entities whos data is stored in the same bucket, i only want one network request, but I cannot figure out how to run a sub-pipeline which returns the same bucket with a use-existing. Or rather, I can do that, but then the "value" in the pipeline cannot contain the entity details.

mihaelkonjevic13:08:11

use-existing will only return existing promise if there is a running pipeline called with the same arguments. You can achieve what you want with the combination of set-queue and dropping behavior: https://github.com/keechma/keechma-pipelines/blob/master/test/keechma/pipelines/core_test.cljs#L1629 In this case, no new pipelines will be started while there is a request in the queue. So, you can dynamically return a queue name based on the data that is used as the pipeline value. If the runtime drops the pipeline return value will be :keechma.pipelines.runtime/cancelled

👍 1
xlfe09:08:35

Thanks for the assistance

xlfe11:08:25

@mihaelkonjevic @tiborkr appreciate your advice if you have a spare minute