Summary
Two related improvements to decouple business registry API calls from the whois regeneration process and introduce a dedicated, rate-limit-aware phone number verification task.
1. Disable Business Registry Checks in whois:regenerate Task
Background:
The whois:regenerate task (lib/tasks/whois.rake) triggers UpdateWhoisRecordJob for all domains in bulk. The whois record update pipeline can invoke the Estonian Business Registry API (via Contact::CompanyRegister / CompanyRegister::Client) to verify company data. These outbound calls are slow, prone to timeouts, and unnecessary during a bulk whois regeneration run — they should not block or slow down the regeneration.
Request:
Disable / skip business registry checks when the whois:regenerate task is running. The task should rebuild whois records using only locally stored data, without making any outbound calls to the Business Registry API.
Acceptance criteria:
- The
whois:regenerate task completes without making any calls to the Estonian Business Registry API. - Existing whois record structure and output are unchanged.
- No regression for non-org contacts or contacts that don't require business registry validation.
2. Add a Separate Rake Task to Check Phone Numbers of Estonian Business Entities Against the Business Registry
Background:
The existing OrgRegistrantPhoneCheckerJob (app/jobs/org_registrant_phone_checker_job.rb) checks whether the phone number of an Estonian org contact (ident_type: "org", ident_country_code: "EE") matches the number recorded in the Estonian Business Registry, and controls phone disclosure accordingly. However, there is no standalone rake task to run this check, and no mechanism to limit daily API calls — which risks hitting Business Registry rate limits when processing large contact sets.
Request:
Create a new rake task (e.g. contact:check_org_phone_numbers) that:
- Iterates over Estonian org contacts whose phone number has not yet been checked against the Business Registry (e.g. a
phone_checked_at IS NULL condition, requiring a new phone_checked_at column on contacts or a similar tracking mechanism). - For each contact, queries the Estonian Business Registry API to verify the phone number and updates disclosure attributes (reusing
OrgRegistrantPhoneCheckerJob logic). - Supports a configurable daily request limit (e.g.
--daily_limit=N CLI option or DAILY_LIMIT env var) to cap the total number of Business Registry API calls per invocation, preventing rate-limit issues. - Includes a configurable sleep/delay between requests.
Example usage:
bash
# Check up to 500 unchecked contacts, then stop
bundle exec rake contact:check_org_phone_numbers -- --daily_limit=500
# Check all unchecked contacts with no limit
bundle exec rake contact:check_org_phone_numbers
Acceptance criteria:
- Task only processes contacts that have not yet had their phone number checked (
phone_checked_at IS NULL or equivalent). - Task respects the
daily_limit option and stops after the given number of API calls. - Task includes a configurable delay between requests.
- Phone number match logic and disclosure behaviour reuse the existing
OrgRegistrantPhoneCheckerJob. - Task is idempotent: re-running does not re-process already-checked contacts.
Related Files
| File |
Relevance |
| lib/tasks/whois.rake |
Whois regenerate task |
| app/jobs/update_whois_record_job.rb |
Whois update job triggered by regenerate |
| app/jobs/org_registrant_phone_checker_job.rb |
Existing phone checker job to reuse |
| app/models/contact/company_register.rb |
Business Registry integration on Contact |
| lib/tasks/company_status.rake |
Reference for rate-limiting (sleep) and daily limit patterns |
Summary
Two related improvements to decouple business registry API calls from the whois regeneration process and introduce a dedicated, rate-limit-aware phone number verification task.
1. Disable Business Registry Checks in
whois:regenerateTaskBackground:
The
whois:regeneratetask (lib/tasks/whois.rake) triggersUpdateWhoisRecordJobfor all domains in bulk. The whois record update pipeline can invoke the Estonian Business Registry API (viaContact::CompanyRegister/CompanyRegister::Client) to verify company data. These outbound calls are slow, prone to timeouts, and unnecessary during a bulk whois regeneration run — they should not block or slow down the regeneration.Request:
Disable / skip business registry checks when the
whois:regeneratetask is running. The task should rebuild whois records using only locally stored data, without making any outbound calls to the Business Registry API.Acceptance criteria:
whois:regeneratetask completes without making any calls to the Estonian Business Registry API.2. Add a Separate Rake Task to Check Phone Numbers of Estonian Business Entities Against the Business Registry
Background:
The existing
OrgRegistrantPhoneCheckerJob(app/jobs/org_registrant_phone_checker_job.rb) checks whether the phone number of an Estonian org contact (ident_type: "org",ident_country_code: "EE") matches the number recorded in the Estonian Business Registry, and controls phone disclosure accordingly. However, there is no standalone rake task to run this check, and no mechanism to limit daily API calls — which risks hitting Business Registry rate limits when processing large contact sets.Request:
Create a new rake task (e.g.
contact:check_org_phone_numbers) that:phone_checked_at IS NULLcondition, requiring a newphone_checked_atcolumn on contacts or a similar tracking mechanism).OrgRegistrantPhoneCheckerJoblogic).--daily_limit=NCLI option orDAILY_LIMITenv var) to cap the total number of Business Registry API calls per invocation, preventing rate-limit issues.Example usage:
Acceptance criteria:
phone_checked_at IS NULLor equivalent).daily_limitoption and stops after the given number of API calls.OrgRegistrantPhoneCheckerJob.Related Files