Skip to content

Feat(max_changes) : Add parameter to specify max number of changes #81

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

Merged
merged 3 commits into from
May 28, 2025

Conversation

BaptisteGallet
Copy link
Contributor

When trying to push a big zone file with a huge amount of record, we face the issue :
dns.exception.TooBig: The DNS message is too big.

In order to solve that, we need to perform changes by batch.
I've added this parameter to let user choose the number of records process per batch with default : 1000

Copy link
Contributor

@ross ross left a comment

Choose a reason for hiding this comment

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

Good catch. I think I'd prefer to build up the full list of updates in the for loop, basically leave that unchanged, and instead convert the section where the update was sent to be a loop over batches of records.

See

https://github.com/octodns/octodns-dnsmadeeasy/blob/a0d86de39834adb72c75b3e35c9850055bd2a539/octodns_dnsmadeeasy/__init__.py#L163-L169

for an example of this in practice. The batching doesn't have to be in a separate method, that's just how it was done there. It works out cleaner that way, avoiding the need to have two difference places where API calls are made and error handled.

@@ -369,6 +369,7 @@ def __init__(
key_name=None,
key_secret=None,
key_algorithm=None,
max_changes=1000,
Copy link
Contributor

Choose a reason for hiding this comment

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

Would prefer to call this update_batch_size or something similar as max_changes sounds like it will limit the number of changes that can be made to the number set and leave the rest un-updated.

Copy link
Contributor Author

@BaptisteGallet BaptisteGallet May 28, 2025

Choose a reason for hiding this comment

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

You're right, it's cleaner to do it in a separated method.
I've implemented the _batch method and reworked the loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Format has been run also to correct the ci.

@ross ross merged commit c15fab2 into octodns:main May 28, 2025
7 checks passed
@ross
Copy link
Contributor

ross commented May 28, 2025

Thanks

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

Successfully merging this pull request may close these issues.

2 participants