Is it possible to save ops in this scenario?

:bullseye: What is your goal?

hi guys, the scenario below represents the flow for booking a parking spot everyday. it gets the one time use token from the data store → checks all the free spots listed → books the first spot received → updates the data store with the new token.

my question is: can i save the 24 ops used for the last module (data store update)? it runs as many times as the http but in every run the same token is given and it’s just a waste of ops.

:thinking: What is the problem & what have you tried?

tried hardcoding a single parking spot ID for booking but in the second the module is working the spot might get booked, that’s why i let the http run for all the spots and getting one time statusCode 201 and for the rest of them 401.

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Hi @Marco8

Probably yes, if you don’t need to update the Data Store with any value from the HTTP call..

Since you’re iterating over an array of N results and 24 of those pass the filter, everything after it will execute 24 times, until your flow finds an Aggregator and the Source module of that Aggregator is the module producing the N bundles. So, place an Aggregator after HTTP and the last module will execute only once.

@damato

2 Likes

now i look stupid haha. you’re right, thanks damato