# New input before finishing previous one

**URL:** <https://discourse.nodered.org/t/new-input-before-finishing-previous-one/34953>\
**Category:** General\
**Created:** [28 October 2020 11:51 UTC](https://discourse.nodered.org/t/new-input-before-finishing-previous-one/34953 "2020-10-28T11:51:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)\
**Post date:** [28 October 2020 11:51 UTC](https://discourse.nodered.org/t/new-input-before-finishing-previous-one/34953/1 "2020-10-28T11:51:06Z")

</div>

Hello  
My current problem is having a flow with some http requests and calcs that is working well while receiving data between intervals, that give it enough time to process and finish.

But I have seen that receiving data very fast, it begins processing the flow without finishing the previous one.

It looks nice in the begining, but the flow goes to a system that requrires an API Token with steps  
"login-\>put data-\>logout"

So, in this scenario, receiving lot of data very fast, login is executed multiples times and the remote server resets the connection.

There is an option that is to get an unique login and conserve the token for few hours without logout  
Looks a good option.

My question is:  
Where do you think is the best place to store the token to query it in every event of receiving batch data ?  
I have tested **context** but it doesn't remember the previous value in a new data entry.

Thank you.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [28 October 2020 12:00 UTC](https://discourse.nodered.org/t/new-input-before-finishing-previous-one/34953/2 "2020-10-28T12:00:01Z")

</div>

Context is the right place to store information you need between individual messages passing through a flow.

> [@crester](#):
>
> I have tested **context** but it doesn't remember the previous value in a new data entry.

Can you expand on that? How are you trying to store the information in context?

---

<div class="post-metadata">

**Author:** ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)\
**Post date:** [28 October 2020 12:14 UTC](https://discourse.nodered.org/t/new-input-before-finishing-previous-one/34953/3 "2020-10-28T12:14:52Z")

</div>

Thank you for your fast response

I am not sure I am doing it well  
I store the data in msg.token and try to query it in a new flow but it is _undefined_  
Perhaps it is wrong

---

<div class="post-metadata">

**Author:** ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)\
**Post date:** [28 October 2020 14:08 UTC](https://discourse.nodered.org/t/new-input-before-finishing-previous-one/34953/4 "2020-10-28T14:08:00Z")

</div>

Okay  
I found it. My fault  
I stored data in

> msg.token

and I have to do in

> flow.token

Now it is working  
Thank you for your comprehension

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 November 2020 14:08 UTC](https://discourse.nodered.org/t/new-input-before-finishing-previous-one/34953/5 "2020-11-11T14:08:09Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
