Skip to content
This repository was archived by the owner on May 25, 2021. It is now read-only.

Conversation

tsutsu
Copy link
Contributor

@tsutsu tsutsu commented Feb 27, 2016

This PR enables a work queue to keep a running total of all the work that's ever been added to it, queryable through the functions total_in/1, total_out/1, and total_held/1. Additionally, a queue(Wq, Item, CountsAs) function-clause has been added and exported, which enables a single queue-item to be counted as an arbitrary number of work-items from the perspective of the running total counters. This allows for the ability to track the total number of individual work-items processed, even when queuing and dequeuing are done in "chunks" of items, as is done in couch_index_updater.

COUCHDB-2955
BugzID: 14036


% public API
-export([new/1, queue/2, dequeue/1, dequeue/2, close/1, item_count/1, size/1]).
-export([new/1, queue/2, queue/3, dequeue/1, dequeue/2, close/1, item_count/1, size/1, total_in/1, total_out/1, total_held/1]).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be wrap this to fit 80 (at least) line right margin?

@kxepal
Copy link
Member

kxepal commented Feb 27, 2016

Here need some tests to make sure that it counts right.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants