How to set 2 timestamp for the same request?

Feed the '1 second' response into a Delay node configured like this


You will get an output from that once every 10 minutes with the latest result in it, which you can then send on to the database. Note the Drop Intermediate Messages selection so that it discards everything else.

Hello and thanks for your help.
it seems to work correctly thanks a lot

It doesn't work exactly as i want because each minutes there s's a gap of few second so after in my chart i hae someting like 1:10 and later 6:23 i prefered to have 1:10 , 2:10 , 3: 10
Do you understand what i mean ? have you got an other solution ?

Can you add a debug node showing what is coming out of the delay node so we can see what you mean?

Actually i work a lot on this flow so data won't be ok.
maybe you can help me to try something else. i put you a jpeg that explain
i would like the same payload before and after CRON NODE PLUS.
i can't have a second httprequest due to a conflict
So with cron node plus i would like to set my paylod to be send every ten minutes to database

Another user has already given you advice about the layout of your flow... How to make a cron with node inject - #17 by UnborN

NOTE - Please stick to just one forum topic, and avoid opening new topics for the same problems!!

Colin's suggestion works fine. the output is the same.
Here's a mockup:

[{"id":"5f42e3079f0afeec","type":"cronplus","z":"4c683dfcd3fa70e5","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"live","topic":"topic","payloadType":"date","payload":"","expressionType":"cron","expression":"* * * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":100,"y":840,"wires":[["8e97bcb79053164c"]]},{"id":"8e97bcb79053164c","type":"function","z":"4c683dfcd3fa70e5","name":"http request","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":840,"wires":[["01b8a64b6a725fd1","208d180f124c980d"]]},{"id":"01b8a64b6a725fd1","type":"debug","z":"4c683dfcd3fa70e5","name":"do something with live data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":540,"y":800,"wires":[]},{"id":"208d180f124c980d","type":"delay","z":"4c683dfcd3fa70e5","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":530,"y":860,"wires":[["b2050a4b0afd62f6"]]},{"id":"b2050a4b0afd62f6","type":"debug","z":"4c683dfcd3fa70e5","name":"do something with database","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":860,"wires":[]}]

Just replace the function node with your http request node.

yes it works but "limit message 10 min" lose 1 second regularly and in the end in my chart i will have someting not fine like 13:12 , 13:23, 13:34 instead of 13:10, 13:20, 13:30.
i go back to work tommorrow ( :frowning: end of hollidays) like that i ll stored data then i'll could show you

Thanks for your help

I can see the problem. The messages will be coming in nominally at 1 second intervals, but some will be a bit more than one second and some will be a bit less. When one that should get through takes a bit less than second then it will be too early for the delay node to let through. Try setting the interval to 9 mins 59.5 seconds, which is 590.5 seconds, then it should always be ready for the one that should get through.

I don't see why you would lose the second. If you run my mockup you will notice that the timestamp from cronplus arriving on both debug nodes is the same. Maybe you lose the second at a different spot?

maybe it' s that . After i have a "date formatter node" then a,"function node" ,. i ll put the delay after these node i ll also set like @Colin suggest.

There will be a variable time delay in the http request node, so the messages will not be exactly 1 second apart. If you put a random delay of a significant fraction of a second in your http simulation function you should be able to see the effect.

@DamianosS @Colin
Just to see you. With the example of Damianos. in 1 hour i lost 5 second.

I’m still not getting it. Why is the delay adding up? I understand that the http request may cause a delay but that delay would be variable and random (I assume).
Am I missing something?

Imagine that the input is going at 1 sample/sec and we are rate limiting at one every 5 seconds. Suppose, due to the http request, the input comes in at
0.5 (that one will start the timer), 1.1, 2.1, 3.1, 4.1, 5.1 (all those will be discarded), 6.1 (that one will get through and restart the timer). Note that one has been missed, and because the interval was restarted late it can happen repeatedly.

However, If you set the node to Rate Limit, For Each msg.topic, then I think the problem goes away, as that uses fixed intervals. Make sure that all the messages have the same (not empty) topic. Doing it this way the interval should be set back to the full 10 minutes.

1 Like

@Colin @DamianosS
Hello. today flow has los 1min 31 secondes. That's why i looked and ask for help to set cron node after http requestbut i don't know how to do. if i leave cron node setting only cron and not payload then i have nothing in my payload.

Have you tried it setting the Delay node as I suggested?

@mykerinos1, I just tested Colin's suggestion. It works.

@DamianosS @Colin
Hello. i just set @Colin solution. I will test until tommorow. but are you sure about 590,05 second becaouse it's near 59 second. 9 minutes 59 second 05
maybe you want to say 9 minutes 59 second and 50 so i think it would be 590,5 second
Or near 60 : 9minutes 59 second 95 599,5

I meant this solution. Have you been reading the posts?