queue

Algorithm for sharing jobs by two executors

♀尐吖头ヾ 提交于 2019-12-06 16:11:03
问题 I encountered the following problem, while testing some web-site: John and Mary founded J&M publishing house and bought two old printers to equip it. Now they have their first commercial deal - to print a document consisting of N pages. It appears that printers work at different speed. One produces a page in X seconds and other does it in Y seconds. So now company founders are curious about minimum time they can spend on printing the whole document with two printers. (taken from here http:/

JQuery problem with stop() and delay() within animation

丶灬走出姿态 提交于 2019-12-06 16:02:01
问题 As you can see on http://jsfiddle.net/FrelCee/5zcv3/4/ , i want to animate those 3 divs when the container is hovered. Problem is this ugly queue that appears when you fast hover more than once. I also tried using .stop() function, but then the delay() isn't working. Here is an example with stop() function and delay() problem : http://jsfiddle.net/FrelCee/FHC99/22/ Does anyone know any better way to this? Thanks in advance! 回答1: You just need to supply at least the first parameter to .stop

Consume from Queue with multiple threads/tasks

风格不统一 提交于 2019-12-06 15:44:43
问题 I have a producer that gets users from a resource and places them into a ConcurrentQueue, then What I want to do is using multiple consumers and process all users and get their information from another resource. public void Populate(IEnumerable<Users> users){ _queue.Enqueue(users); // here single threaded } public void Process(){ // here i want this to be processed by multiple consumers // say multiple threads so that I can finish processing them. } My question is, should i use thread? task?

Are django signals always synchronous?

点点圈 提交于 2019-12-06 15:40:36
I'm developing a django IPN plugin that saves IPN data to a model and then calls a post_save signal. I'm worried that under this use case (gunicorn, gevent, etc) that the signals may be called/completed asynchronously. The IPN often sends more than 1 request to the ipn url, and I need to be able to process those requests in order. Should I use a queue for this? Would simple python queue's work better, or should I use something like kombu + celery (with 1 worker)? Not sure synchronicity is your real concern here. Django's signals are always executed in-process : that is, they will be executed

In Perl 5, how to queue a process/application after it reaches a maximum limit

大兔子大兔子 提交于 2019-12-06 15:32:20
I have a program that is being symlinked to multiple directories e.g. /main/foo.pl /run1/foo.pl -> /main/foo.pl /run2/foo.pl -> /main/foo.pl /run3/foo.pl -> /main/foo.pl /run4/foo.pl -> /main/foo.pl They're being run as cron jobs, hence I have the following entries in the crontab: */2 * * * * /run1/foo.pl */2 * * * * /run2/foo.pl */2 * * * * /run3/foo.pl */2 * * * * /run4/foo.pl A snippet of foo.pl is as below: use Fcntl qw(:flock); use autodie qw(:all); open my $self, '>', "$FindBin::Bin/lockme"; flock( $self, LOCK_EX|LOCK_NB ) or die "Cannot acquire lock, already running!"; { my $long_proc =

Supervisorctl does not auto-restart daemon queue worker when hanging

谁都会走 提交于 2019-12-06 15:02:40
I have supervisorctl managing some daemon queue workers with this configuration : [program:jobdownloader] process_name=%(program_name)s_%(process_num)03d command=php /var/www/microservices/ppsatoms/artisan queue:work ppsjobdownloader --daemon --sleep=0 autostart=true autorestart=true user=root numprocs=50 redirect_stderr=true stdout_logfile=/mnt/@@sync/jobdownloader.log Sometimes some workers are like hanging (running but stop getting queue messages) and supervisorctl does not automatically restart them, so I have to monitor and manually restart them. Is there something wrong with the

Producer/Consumer - producer adds data to collection without blocking, consumer consumes data from collection in batch

纵饮孤独 提交于 2019-12-06 14:19:47
问题 I have a Producer/Consumer usecase which is a bit unusual. I have a real world use case with some producers which I want them to be able to add objects into a collection without blocking. The consumer (just one) should block until a certain amount of objects are available in the collection (eg. 500) and then consume them in bulk. While there are less than 500 it should block and wait for the collection to fill. I don't mind if the queue exceeds this value (700, 1000 etc.) for short amount of

Exception java.lang.NoSuchMethodError on java.util.Deque.push

混江龙づ霸主 提交于 2019-12-06 14:18:02
问题 It's really strange, Google Developer Console, error reporting page. As it seems, my application crashes on several Android devices. The exception log provided says: java.lang.NoSuchMethodError: java.util.Deque.push at com.larvalabs.svgandroid.SVGParser$SVGHandler.<init>(SVGParser.java:869) at com.larvalabs.svgandroid.SVGBuilder.build(SVGBuilder.java:147) at myapp.graphic.PictureCache.getSvgPicture(PictureCache.java:59) at myapp.graphic.PictureCache.getSvgPictureDrawable(PictureCache.java:65)

C++ bound method queue (task manager/scheduler?)

大兔子大兔子 提交于 2019-12-06 13:24:55
Is there a method/pattern/library to do something like that (in pseudo-code): task_queue.push_back(ObjectType object1, method1); task_queue.push_back(OtherObjectType object2, method2); so that I could do the something like: for(int i=0; i<task_queue.size(); i++) { task_queue[i].object -> method(); } so that it would call: obj1.method1(); obj2.method2(); Or is that an impossible dream? And if there's a way to add a number of parameters to call - that would be the best. Doug T. please see this Excellent answer! Dave Van den Eynde 's version works well too. Yes you would want to combine boost:

notify() instead of notifyAll() for blocking queue

*爱你&永不变心* 提交于 2019-12-06 12:04:21
问题 I am trying to find out whether it is possible to have a multiple producer / multiple consumer queue where I can use notify() instead of notifyAll() . For example, in the implementation below (source: here) you cannot just simply switch the notifyAll() for notify() . It is not totally obvious why you cannot switch so I will leave it as an teaser to whoever wants to help me out understanding this problem. So the code below is broken: public class BlockingQueue { private Object lock = new