queue

Non-busy blocking Queue Implementation in C

南楼画角 提交于 2019-12-21 05:58:07
问题 I am trying to implement a queue in C that causes a process to non-busy wait until there is an element in the queue to consume. I have tried two different things to try to achieve this. The first problem I have is if the enqueue/dequeue operations have if conditionals to check the bounds( if (q->count == QUEUESIZE) ), the call to sem_wait will return immediately because no other process has obtained a lock. If I change the conditional to while (q->count == QUEUESIZE), I believe the consumer

How do I create celery queues on runtime so that tasks sent to that queue gets picked up by workers?

走远了吗. 提交于 2019-12-21 05:57:20
问题 I'm using django 1.4, celery 3.0, rabbitmq To describe the problem, I have many content networks in a system and I want a queue for processing tasks related to each of these network. However content is created on the fly when the system is live and therefore I need to create queues on the fly and have existing workers start picking up on them. I've tried scheduling tasks in the following way (where content is a django model instance): queue_name = 'content.{}'.format(content.pk) # E.g. queue

RabbitMQ AMQP queue design

自闭症网瘾萝莉.ら 提交于 2019-12-21 05:49:05
问题 Below is the desirable design of the queue with: P producer. The application that insert data X exchange. C1-C3 consumer. The applications that read from the queue Queue details: A. Is just like queue log, if there is no client binding then message will be discarded. B. This is a working queue. it will do something if there is criteria match. C. Also a working queue. it will transform the data A is optional, but B. C. will always in queue until some client process connect it. The problem is

Producer/consumer pattern with a fixed-size FIFO queue

陌路散爱 提交于 2019-12-21 04:53:45
问题 I need to implement the producer/consumer pattern around a fixed-size FIFO queue. I think a wrapper class around a ConcurrentQueue might work for this but I'm not completely sure (and I've never worked with a ConcurrentQueue before). The twist in this is that the queue needs to only hold a fixed number of items (strings, in my case). My application will have one producer task/thread and one consumer task/thread. When my consumer task runs, it needs to dequeue all of the items that exist in

Laravel 5.1 failed queued jobs fails on failed() method, prevents queue failure event handler from being called

余生长醉 提交于 2019-12-21 04:52:10
问题 I am testing the queue functions in Laravel 5.1. I can make jobs queue up in my db table, called jobs, and I can get them to run successfully. I also created a queue failure table called failed_jobs. To test it, inside the jobs table I manipulate the payload data to make it fail then I run the queue worker daemon like so, so it will put the job in the failed_jobs table after one failed attempt: php artisan queue:work --daemon --tries=1 --queue=myqueue When the job fails it is immediately put

Why use heap instead of binary tree when implementing priority queue?

夙愿已清 提交于 2019-12-21 04:28:21
问题 It seems to me that the only advantage of heap over binary tree is to find the smallest item in the heap in complexity of O(1) instead of O(log(2)n) in binary tree. When implementing priority queue you need to delete the smallest item each from the data structre. deleting the smallest item from a tree and both heap done in complexity of O(log(2)n). Althogh deleting item from a tree may be more complex. Deleting item with no childrens acctually very simple. My question is why use heap instead

Queue using table

心不动则不痛 提交于 2019-12-21 02:58:07
问题 I need to implement a queue using table. The business requirement is to have a single queue which will be accessed by 5-10 boxes to get the next job/jobs. There will not be more than 5000 jobs per day. Also, a batch of jobs should be "dequeued" at one time. Just wondering what are the problem areas and issues I might run into as I havent done it before. If anyone has faced this/done this before, can you please point me to a design/sample implementation or issues that need to be taken care of.

Using Javascript to rate limit and queue ajax calls to once every 15 seconds

耗尽温柔 提交于 2019-12-21 02:53:27
问题 I have an application that automatically tweets every time a user does something... Users can easily perform that action once every second if they like. Twitters rate limit says that it pays attention to how many tweets happen in 15 minutes. Technically I think I am always below the 15 minute mark, but it seems like twitter also says "hey you can post 15 posts in 15 minutes, but not 15 posts in 15 seconds"... which is reasonable I think... I would like to solve this problem on javascript side

Laravel 5.4 - php artisan cache:clear does not clear cache files when using 'file' cache driver

丶灬走出姿态 提交于 2019-12-20 18:15:23
问题 Laravel 5.4 app. CACHE_DRIVER is set to file and QUEUE_DRIVER is set to sync in .env . When I run php artisan cache:clear It says Cache cleared successfully yet I still have 236K of files in my storage/framework/cache directory. Frustrated by this, I also manually deleted all files/directories under storage/framework/cache using rm -rf * from that directory. Now, when I run art queue:restart I get [ErrorException] file_put_contents(/var/www/vhosts/my-app.com/releases/28/storage/framework

Processing a queue of items asynchronously in C#

佐手、 提交于 2019-12-20 16:48:11
问题 I am trying to create a system that processes a queue of work. The system has the following specifications: The system has two components, a work assigner and a worker. There is a set upper limit on the number of workers running at the same time. That upper limit is greater than one. To avoid problems with the same task being worked on twice, there is only a single work assigner. What design would you use to create such a system? Here is what I am thinking: Create a collection of queues, one