<commit_before># stubborn_queue

Sometimes you want to make sure that stuff on your queue gets done. This stubborn queue will insist that something isn't done until you tell it otherwise. Unfinished items get requeued after a specified amount of time because you didn't do it right. I store the data in file to avoid dependencies outside of Ruby itself.

## Heads up!

This is in no way inherently thread- or process-safe. It's built for one process owning one queue file and not interacting with it asynchronously.
<commit_msg>Added usage to the README<commit_after># stubborn_queue

Sometimes you want to make sure that stuff on your queue gets done. This stubborn queue will insist that something isn't done until you tell it otherwise. Unfinished items get requeued after a specified amount of time because you didn't do it right. I store the data in file to avoid dependencies outside of Ruby itself.

## Usage

```
important_data = StubbornQueue.new name: 'important_data', timeout: 60
length = important_data.enqueue 'top secret!'
id = important_data.dequeue
data = important_data.lookup id
do_something_with data
important_data.finish id
```

If `do_something_with` takes longer than 60 seconds, it'll assume that you crashed out and requeue it for another worker.

## Heads up!

This is in no way inherently thread- or process-safe. It's built for one process owning one queue file and not interacting with it asynchronously.

{'fraction_non_alphanumeric': 0.045993031358885016, 'fraction_numerical': 0.0027874564459930314, 'mean_word_length': 4.698412698412699, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1130475', 'n_tokens_mistral': 380, 'n_tokens_neox': 352, 'n_words': 211}