RAILS SIDEKIQ SCHEDULER - ruby-on-rails-5

I would like to launch the worker after an action and this worker must be launch automatically after every 5 seconds to check a status and when the status is checked, it must be stops. How can I do that? Thanks for your help

Related

Polling in Jmeter

I am trying to run a test plan wherein in a thread I have multiple requests added. I need to run one event fetching requests at regular intervals of 2 seconds until the complete execution of the thread.
Can someone please help me with the same ?
I have tried running the plan by adding timers and controllers but to no use.
Take a look at While Controller, it executes its children while JMeter Function or Variable you set in the "Condition" input field resolves to true
The delay can be introduced by either using a
Constant Timer - will create a delay before each Sampler it its scope
Flow Control Action Sampler - will create a delay exactly where it's placed in the script

How to obtain the return value from a function enqueued in rq?

From the documentation of redis queue https://python-rq.org/docs, I came to know that the worker can return results only after a certain time and till then return None.
Is there any way to find out that the worker execution is complete (not with time.sleep() pls.) ?
In my case what is happening is the worker keeps running and the data displayed on the UI is None as the control moves to my rendering of UI code as soon as worker is assigned the task and doesnot wait to complete the execution ?
Pls. help me.
I know it's been a year, but if someone else needs it:
that depends on your needs - I'd use supervisor, do you can easily see updated output of each running worker/process, either with the output file, or in the browser, with the inet_http_server section
if you want something done, after the current job has finished - just chain jobs to the queue.
you only need to specify the job in the "depends_on" parameter.docs

JMeter How to run two parallel thread sets consecutively

I need to create a Thread Group Using JMeter with 5 Thread Groups.
This is how I want this test to run:
Thread 1 and 2 Starts Parallelly. (But Thread 1 only runs once and Thread 2 runs till it gets a success)
Once Thread 2 finishes running, Thread 3 and 4 should start running parrallaly.(But Thread 3 only runs once and Thread 4 runs till it gets a success)
Once Thread 4 finishes Thread 5 needs to start.
Really appreciate if you can guide me to achieve this task.
Thanks in Advance.
If you don't need to pass anything between the Thread Groups the easiest would be just putting all the requests under one Thread Group and control the concurrency using Parallel Controller
If you need to pass something between Thread Groups, i.e. Thread3 requires some data from Thread2 - consider using Inter-Thread Communication Plugin
Both plugins can be installed using JMeter Plugins Manager

dispatch_async vs beginBackgroundTaskWithExpirationHandler

I need to implement a background process in an iOS app, that performs a job every 60 seconds. I know this can only be done while the app is in focus, but I do want this job to finish running in the background after the app is closed. I will use GCD to dispatch a timer that calls my job asynchronously every 60 seconds using either dispatch_async or beginBackgroundTaskWithExpirationHandler.
I am wondering which method is the best, or if they are essentially the same. Is it okay to use beginBackgroundTaskWithExpirationHandler to execute a job even while the app is in the foreground? Or am I better off trying to cancel the job when the app state changes, and then restart the job as a background task?
-beginBackgroundTaskWithExpirationHandler: doesn't run code on a background thread/queue. It tells the OS that you are going to continue doing work when your app is not active.
The two serve completely different purposes.

make resque workers more instant responding? guidelines for configuration

Im using resque to have some jobs running in the background, a client ( user ) initiates these by doing an action on the web app in there browser.
The problem is it takes several seconds for the action to be triggered. How could one speed it up ? I need resque to respond more instant.
IM using all default setup and config nothing modified.
Are there any guidelines for configuration or suggestions out of the field to make resque response faster?
Im running with 1 worker and low queues like 1,2 at a time.
Resque workers check the queue every 5 seconds by default, taken from the Resque page on Github:
start
loop do
if job = reserve
job.process
else
sleep 5 # Polling frequency = 5
end
end
shutdown
Under "Polling frequency" it then says:
You can pass an INTERVAL option which is a float representing the polling frequency.
The default is 5 seconds, but for a semi-active app you may want to use a smaller value.
$ INTERVAL=0.1 QUEUE=file_serve rake environment resque:work
Also you could have a look at something like beanstalkd instead, you can watch this railscast about it.