queue

Checking if a JavaScript setTimeout has fired

為{幸葍}努か 提交于 2019-12-06 01:26:31
I'd like to be able to dispatch a bunch of work via JavaScript to be done in the browser in such a way that the browser stays responsive throughout. The approach I'm trying to take is to chunk up the work, passing each chunk to a function that is then queued with a setTimeout(func, 0) call. I need to know when all the work is done, so I'm storing the returned timer ID in a map (id -> true|false). This mapping is set to false in the next block of code after I have the timer ID, and the queued function sets the mapping to true when it completes... except, of course, the queued function doesn't

how to get the queue in which a task was run - celery

谁说胖子不能爱 提交于 2019-12-06 01:23:35
I'm new using celery and have a question. I have this simple task: @app.task(name='test_install_queue') def test_install_queue(): return subprocess.call("exit 0",shell=True) and I am calling this task later in a test case like result = tasks.test_default_queue.apply_async(queue="install") The task run successfully in the queue install (because I am seeing it in the celery log, and it completes fine. But I would like to know a programmatically way of finding in which queue was the task test_install_queue run, from the object stored in result . Thank you! EDIT: I've changed the tasks to be like:

How to use Models in a Laravel Queue

此生再无相见时 提交于 2019-12-05 23:50:54
I'm trying to import a mailing list from CSV to my DATABASE. I have two models in my Laravel which is responsible for doing this: Target and Mailing (one Target has many Mailing s) I'm using Queue system with Beanstalkd. I'm using: Queue::push('ImportCSV', array( 'file' => $file->getClientOriginalName(), 'target' => $name )); To push my jobs and then I have the ImportCSV job class: class ImportCSV { public function fire($job, $data) { Log::info("Starting to add {$data['target']} to database"); $target = new Target(); $target->name = $data['target']; $target->save(); $reader = new \EasyCSV

How to implement a dequeue using two stacks

一个人想着一个人 提交于 2019-12-05 21:15:51
Dequeue - Doubly ended queue: en-queue and de-queue possible from both ends. How to define ADT operations for dequeue using 2 stacks. Implementation should also take into consideration the performance. the simplest solution would be to use one stack as the head of the queue, and one as the tail. The enqueue operations would just be a push to the respective stack, and the dequeue operations would just be a pop on the respective stack. However, if the stack you want to dequeue from is empty, you'd have to pop each element from the other stack and push it back to the stack you want to dequeue

Queue Multithreaded Methods for Execution

不问归期 提交于 2019-12-05 19:50:39
All, I have a generic method called TaskSpin , in this method I launch a Task with an ascociated continutation public TaskSpin(Func asyncMethod, object[] methodParameters) { ... asyncTask = Task.Factory.StartNew<bool>(() => asyncMethod(uiScheduler, methodParameters)); asyncTask.ContinueWith(task => { // Finish the processing update UI etc. } ... } The problem is now that I want to run multiple methods using TaskSpin , but I need to restrict the methods to run one-at-a-time. So foreach row in some DataGridView I want to do something like foreach (DataGridViewRow row in this.DataGridViewUrg.Rows

Special queue with defined size

≯℡__Kan透↙ 提交于 2019-12-05 19:15:41
I need a collection that is limited in its size. It has to be similar to a circular buffer. I think that the fastest way to describe it would be by making an example. Suppose I have an instance of this "special" queue, of size 4. This is the queue initially: 6 3 9 2 If I push something into it, it has to add it at the beginning, remove the last element and return its value, so, if I add 3 it would become: 3 6 3 9 and returns 2 I hope I've been clear... A general implementation is sufficient, but a C# implementation would be the best :) public class MyQueue<T> { private Queue<T> queue; public

Azure Service Bus: transient errors (exceptions) received through the message pump with built-in retry policy. Why?

我的未来我决定 提交于 2019-12-05 19:08:32
I've been reading on the Event-Driven Message Programming Model introduced in April 2013, the OnMessageOptions.ExceptionReceived Event , the built-in RetryPolicy (May 2013, RetryPolicy.Default), The Transient Fault Handling Application Block (2011) which is outdated, and more (see bottom). I've been monitoring the exceptions received through the message pump for transient errors and I get daily MessagingCommunicationExceptions . This article (Updated: September 16, 2014), recommend the following : This exception signals a communication error that can manifest itself when a connection from the

How to make function run in background in laravel

非 Y 不嫁゛ 提交于 2019-12-05 19:04:13
问题 I am developing a website in Laravel 5.0 and hosted in Windows Server2012. I am stuck at a problem which is I am calling a function B in controller from another function A and I want that the function A which calls the another function B does not wait for the completion of function B . And Function B gets completes in the background and independent form user termination of page and function A return . I have searched this and found that this can be implemented through cron like jobs in

std::queue memory consumption leads to memory leak - C++ ?

◇◆丶佛笑我妖孽 提交于 2019-12-05 18:15:26
The following codes didn't release the memory consumed for 3000 elements even after i pops out all the elements from the qInt queue. What is the reason ? std::queue<int> qInt; //Step01: Check the running memory for (int i=0;i<3000;i++) { qInt.push(i); } //Step02: Check the running memory it should have been increased while(!qInt.empty()) { qInt.pop(); } //Step03: Check the running memory expecting Step01 memory but it is still the same of Step02 By defalut std containers do not deallocate memory once they have reserved it. The std::queue is generally implemented on type of std::dequeue which

REST: Add message to azure storage queue without base64 encoding?

Deadly 提交于 2019-12-05 17:46:18
I don't have the possibility to encode my request to base64, and according to the documentation I shouldn't have to, but I can't figure it out. If I Base64 encode it's working fine: <QueueMessage> <MessageText>PHNhbXBsZT5zYW1wbGUgbWVzc2FnZTwvc2FtcGxlPg==</MessageText> </QueueMessage> Which adds the decoded message to the queue: <sample>sample message</sample> According to the documentation ( https://msdn.microsoft.com/sv-se/library/azure/dd179346.aspx ) A message must be in a format that can be included in an XML request with UTF-8 encoding. To include markup in the message, the contents of