openBackhaul / ApplicationPattern

Pattern for REST servers
Apache License 2.0
6 stars 15 forks source link

To make /v1/register-yourself to trigger either one of PromptForRegisteringCausesRegistrationRequest or PromptForRegisteringCausesRegistrationRequest2 #989

Open PrathibaJee opened 3 months ago

PrathibaJee commented 3 months ago

As of now , /v1/register-yourself will trigger the callback PromptForRegisteringCausesRegistrationRequest first then , PromptForRegisteringCausesRegistrationRequest2 will be executed regardless of the respective HTTP response codes.

Scenario : If an already approved application triggeres register-yourself , then both the callbacks PromptForRegisteringCausesRegistrationRequest PromptForRegisteringCausesRegistrationRequest2 will be executed

Problem : As a result TAR will send regard-updated-approval-status twice immediately. And the whole process of /regard-application to the TAC is happening twice. Since the regard-application involves multiple sub processes , performing it immediately for two times is making the,

  1. process more heavy
  2. inconsistently database holds 2 entry of the approved application

Proposal : So proposing the following , callbacks shall be executed in this order , PromptForRegisteringCausesRegistrationRequest2 if PromptForRegisteringCausesRegistrationRequest2 fails(means RO is less than 2.1.1) then PromptForRegisteringCausesRegistrationRequest will be initiated

PrathibaJee commented 3 months ago

Temporarily this issue is fixed in the commit https://github.com/openBackhaul/ApplicationPattern/commit/5d6521412015de6a3ba4f57c503029988cd8c57d. Since this is not a blocking issue for now , this issue shall be resolved in the future releases. Thanks

openBackhaul commented 1 month ago

Ordering of PromptForRegisteringCausesRegistrationRequest2 and PromptForRegisteringCausesRegistrationRequest changed as proposed. Descriptions updated.

PromptForRegisteringCausesRegistrationRequest to be deleted in AP v3.0.0 .