I am doing an operation which consists of sending an api request from a function node to a http node. The operation modifies a label on a remote resource. Due to some limitation the modification operation cannot be done directly but consists of removing the existing label and adding a new label. This corresponds to sending two requests to the http node - first a deletelabel followed by addlabel:
for (var count = 0; count < num_resources; count++) {
//example url
msg.url = "https://myresourceurl/";
//delete existing label
msg.payload = JSON.stringify(del_label_jsonobj);
node.send(msg);
//add new label
msg.payload = JSON.stringify(newlabel_jsonobj);
node.send(msg);
}
The issue is that its not doing it reliably. If there are 10 resources to modify, these are the behaviours I have observed:
- Most of the resources have both the newlabel and the old label present (which means deletelabel did not work but addlabel worked)
- Few labels have only modified label (which means both the operation worked)
The code seems to be ok since it works 100% reliably if the addlabel and deletelabel are done individually. It's the combination of two operation that does not work. Any insight/help is appreciated.