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

Expand oputil mb functionality to purge/pack/reset mail areas #550

Open
voipmeister opened this issue Aug 24, 2024 · 3 comments
Open

Expand oputil mb functionality to purge/pack/reset mail areas #550

voipmeister opened this issue Aug 24, 2024 · 3 comments

Comments

@voipmeister
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently, we need to manipulate the message base using sqlite3.

Describe the solution you'd like
It would be great if the ./oputil.js mb command could be used to do the following:

  • purge messages older than X days
  • purge messages when the count in the area reaches Y
  • reset (empty) an area completely (e.g. to resync it from the hub)

The first two options could be achieved by adding parameters in the area properties in the config.hjson file:

messageConferences: {
    tqwnet: {
        name: tqwNet
        desc: tqwNet Areas
        sort: 2
        default: true
        areas: {
            tqw_ads: {
                name: "[TQW] BBS Adverts"
                desc: "[TQW] BBS Adverts"
                max_age: 365
                max_count: 2000
        }
    }
}

In this example, max_age: 365 would cause messages older than 365 days in the area tqw_afs to be purged. Question is, would the date of import be considered or the send date of the message? (haven't looked in the database yet, I'd vote for the latter if it would be a choice).

The parameter max_count: 2000 would obviously cause a purge of messages older than the last 2000 messages. Again, not sure about which date to consider.

A separate reset option would be useful to reset (empty) an area if so desired. Maybe a wildcard could be implemented, although that might be a risky option. Likewise, maybe a reset-conference option could be implemented, not sure how often you'd use that though.

The first two would be very nice to have IMHO, because we could have a maintenance oputil job run every day/week to maintain the message base.

Describe alternatives you've considered
Hacking away with sqlite3, which is kinda... error prone? ;)

Additional context
Nothing further, I think :)

@NuSkooler
Copy link
Owner

NuSkooler commented Aug 27, 2024

@voipmeister This is actually already implemented, sorta. Just not exposed via oputil ... yet.

You can currently set any of/combination of the following in your area's config:
maxMessages
maxAgeDays

Setting e.g. maxAgeDays to 0 disables any max.

The system will keep the areas up to date with these params.

I will keep this ticket open for oputil mb purge [--max-age-days, --max-messages] to run with current config "now", or override with the params. Does that work for you?

EDIT: We also need some documentation updates on these fields in the message area docs, would love a PR :D

@voipmeister
Copy link
Contributor Author

I will keep this ticket open for oputil mb purge [--max-age-days, --max-messages] to run with current config "now", or override with the params. Does that work for you?

Yes, that would work 👍

EDIT: We also need some documentation updates on these fields in the message area docs, would love a PR :D

Let me see what I can do about that 🙂

@voipmeister
Copy link
Contributor Author

PR #552 created :)

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

No branches or pull requests

2 participants