is possible to set a value in neoload variables of type constant string or date from a js script action? - neoload

i have a script that contains a token which it s must be refreshed every 10 min , so i add a fork and js to calculate the time spent between start time and end time .
So i want to set the value calculated to a variable so that I can make a condition on this value after in my script to refresh my token .
isi have a script that contains a token which it s must be refreshed every 10 min , so i add a fork and js to calculate the time spent between start time and end time . that possible ? if its not how can i do it to resend my request ?

I think you actually don't need to calculate the time spent between start time and end time.
The fork action stop when the main thread stop. You just have to put an infinite loop in your fork with your refresh request and extract the token in this request. at the end of your userpath, the infinite loop will end automatically.

Related

Get all Durable Function instances over a time period

I have been trying to use the Durable Functions HTTP API Get Instances call to get a list of Completed/Failed/Terminated instances to delete over a given time period, batched in groups of 50: /runtime/webhooks/durabletask/instances?code=xxx&createdTimeFrom=2021-11-06T00:00:00.0Z&createdTimeTo=2021-11-07T00:00:00.0Z&top=50
As per the documentation, if the response contains the x-ms-continuation-token header then there are more results and I should make another call adding the x-ms-continuation-token to the request headers... even if I get no results in the body (the first few calls always seem to return no results but then I start getting results after that for a while before dropping back to no results). My issue is that this never seems to end because there is always a continuation token even after running for 20+ minutes and hundreds of calls for the same date range. This doesn't happen for the Durable Function Monitor extension for VS Code.
What am I missing from the documentation that will tell me when to stop looking for more records if the x-ms-continuation-token header is always present?

How does the increment operation on FirebaseRealtimeDatabase work?

I was looking at the Firebase documentation and saw that you can increment a data in the database with the following line:
Database.database().reference().child("Post").setValue([
"number" : ServerValue.increment(10)
])
It also says on the documentation that "the increment operation occurs directly on the database server", I don't really understand what that means. What is the difference between this operation and an operation like :
// We have previously retrieved the value of number which we have stored in a variable
Database.database().reference().child("Post").setValue([
"number" : numberOldValue + 10
])
Instead of you getting the value from the server and doing that little "atomic" action of adding a integer to another one the increment allows you to just say for what value you want to increment the one on the server. It works on the server side so you don't need to worry at all to get the current value. If it changes in a millisecond before you send your request it will notice that.
Extra info: It is also much faster than the transaction. Check it out here.
Transaction VS ServerValue
When working with data that could be corrupted by concurrent modifications, such as incremental counters, you can use a transaction operation,Using a transaction prevents current increment from being incorrect if multiple users star the same post at the same time or the client had stale data.
The benefit of ServerValue.increment(10) makes you no worry about grabbing the current value to increment it as it will get the current value and increment it with sent value automatically

How to make left time count backward

Example is about groupon.com. As we know it say time left for certain products and counts every second. So I can do it with javascript but server side should I update it through Ajax all products left time attribute every second or how to update it in server without AJAX
Anybody knows?
1) Something should update my products timeLeft on server?
I can't find that something.
Only thing I can do is update them through ajax.
The easiest and best way to do count-downs is client-side. Trying to store and update that kind of information is a huge waste of time, space, and processing.
Basically, your database should have the ending time on it, and that will get sent to the client. Then the client will update every second using javascript:
var timeLeft = product.endTime - currentTime;
Then you can update timeLeft every second.

Realtime timer that counts down time for ruby on rails app

Im in the need on some advise for a realtime serverside timer that would countdown from say 100 seconds. Reason for serverside timer is no tampering.
currently use delayed job but problem its not realtime i could mimic a timer by creatind job every second, but dirty solution
need to display time in view by getting timer value with ajax call to method that returns servertime on page. Know how to do this just to give idea. reload timer would still countdown correctly even on reload page.
Anyone could advise to get a realtime counter in rails app serverside? I would want to create one or more independant timers i can get a value from in railsapp.
Why don't you just create the record you need, but add a "don't open before" DateTime field you can check to see if it's okay to show it?
This sort of thing is trivial to do, and you can set a timer on the client to count-down in JavaScript, then reload the page with the final data at the appropriate time. If someone is impatient and reloads early, you can compute the number of seconds remaining before it can be shown using simple math:
time_left_in_seconds = record.show_at.to_i - Time.now.to_i
Then all you have to do is show a JavaScript timer for that number of seconds, then trigger a page refresh.

time compare in windows servuce

I had written one windows service in C#.NET which fires on every miniutes... I want to execute certain code(some logic) on every month on say xyz date.... this task shld repeted on every month on same date... So can any one tell me how to do this..? I mean to say the block of code which i will write shld get executed on same date of every month...
Deploy this as a scheduled task rather than a service.

Resources