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

PAY-7552: Update to improve uniqueness of RC number generation #1759

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

davejones74
Copy link
Contributor

@davejones74 davejones74 commented Jan 21, 2025

Jira link

https://tools.hmcts.net/jira/browse/PAY-7552

Change description

Minor change to the RC generation.

Current format RC-XXXX-XXXX-XXXR-RRRL
Where
X - DateTime millisecond number / 100
R - 4 Digit SecureRandom Generated Number
L - Luhn forumla check digit

New apporach is to remove the devision in the milliseconds as that's losing precision - this means the random rumber drops from 4 digits to 2.

Current format RC-XXXX-XXXX-XXXX-XRRL
Where
X - DateTime millisecond number
R - 2 Digit SecureRandom Generated Number
L - Luhn forumla check digit

In tests from 1000 consecutive requests - not particularly realistic, ~7000 average collisions for the old code, ~6000 average collisions for the new code, but the new code should work better is real world scenarios.

Testing done

Checklist

  • commit messages are meaningful and follow good commit message guidelines
  • README and other documentation has been updated / added (if needed)
  • tests have been updated / new tests has been added (if needed)
  • Does this PR introduce a breaking change

@davejones74 davejones74 changed the title PAY-7552: Update to improve uniqueness of RC number. PAY-7552: Update to improve uniqueness of RC number generation Jan 21, 2025
@hmcts-jenkins-a-to-c
Copy link
Contributor

Plan Result (aat)

Plan: 0 to add, 2 to change, 0 to destroy.
  • Update
    • azurerm_api_management_subscription.fee_pay_team_telephony_subscription
    • azurerm_api_management_subscription.pcipal_supplier_subscription
Change Result (Click me)
  # azurerm_api_management_subscription.fee_pay_team_telephony_subscription will be updated in-place
  ~ resource "azurerm_api_management_subscription" "fee_pay_team_telephony_subscription" {
      ~ allow_tracing       = false -> true
        id                  = "/subscriptions/96c274ce-846d-4e48-89a7-d528432298a7/resourceGroups/cft-aat-network-rg/providers/Microsoft.ApiManagement/service/cft-api-mgmt-stg/subscriptions/5a89d26c-6d91-4997-8a4e-13e4e279ee0a"
        # (10 unchanged attributes hidden)
    }

  # azurerm_api_management_subscription.pcipal_supplier_subscription will be updated in-place
  ~ resource "azurerm_api_management_subscription" "pcipal_supplier_subscription" {
      ~ allow_tracing       = false -> true
        id                  = "/subscriptions/96c274ce-846d-4e48-89a7-d528432298a7/resourceGroups/cft-aat-network-rg/providers/Microsoft.ApiManagement/service/cft-api-mgmt-stg/subscriptions/ea576e34-00bd-4eff-80d5-85f6c6392bb2"
        # (10 unchanged attributes hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

@hmcts-jenkins-a-to-c
Copy link
Contributor

Plan Result (prod)

Plan: 0 to add, 2 to change, 0 to destroy.
  • Update
    • azurerm_api_management_subscription.fee_pay_team_telephony_subscription
    • azurerm_api_management_subscription.pcipal_supplier_subscription
Change Result (Click me)
  # azurerm_api_management_subscription.fee_pay_team_telephony_subscription will be updated in-place
  ~ resource "azurerm_api_management_subscription" "fee_pay_team_telephony_subscription" {
      ~ allow_tracing       = false -> true
        id                  = "/subscriptions/8cbc6f36-7c56-4963-9d36-739db5d00b27/resourceGroups/cft-prod-network-rg/providers/Microsoft.ApiManagement/service/cft-api-mgmt-prod/subscriptions/7229a544-a882-4520-a81e-2cd4ed6f0031"
        # (10 unchanged attributes hidden)
    }

  # azurerm_api_management_subscription.pcipal_supplier_subscription will be updated in-place
  ~ resource "azurerm_api_management_subscription" "pcipal_supplier_subscription" {
      ~ allow_tracing       = false -> true
        id                  = "/subscriptions/8cbc6f36-7c56-4963-9d36-739db5d00b27/resourceGroups/cft-prod-network-rg/providers/Microsoft.ApiManagement/service/cft-api-mgmt-prod/subscriptions/abd7d0f5-77bc-462c-a658-c8d1e1b40837"
        # (10 unchanged attributes hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

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

Successfully merging this pull request may close these issues.

1 participant