Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize some BAC methods #1463

Open
2 tasks
prioux opened this issue Jan 20, 2025 · 1 comment
Open
2 tasks

Standardize some BAC methods #1463

prioux opened this issue Jan 20, 2025 · 1 comment
Assignees

Comments

@prioux
Copy link
Member

prioux commented Jan 20, 2025

In the BackgroundActivity core class, provide the following base methods:

def failed_items
def successful_items
def remaining_items

We already have the following helpful methods that can be used to implement them:

def selected_items_from_nil_messages
def selected_items_from_present_messages
def selected_items_from_messages_matching(regex)

These last three method should become protected, and the main methods of this issue (failed_items, successful_items and remaining_items) will become the real interface.

Subclasses can overrride them or simply invoke the appropriate selected_items_* methods.

By default (because it's the most common situation), failed_items will just invoke selected_items_from_present_messages and successful_items will invoke selected_items_from_nil_messages.

The method remaining_items is always just what's not yet processed, so the tail end of the items list.

  • Add methods
  • Adjust all subclasses, as necessary (only those that don't follow the "NIL message means success" convention)
@prioux prioux self-assigned this Jan 20, 2025
@prioux
Copy link
Member Author

prioux commented Jan 20, 2025

We could then add a method

def reset_failed_items!

which would prune the items list of anything correctly processed, and leav only the failed ones

Also, the "retry" mechanism could be adjusted to use these methods now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant