File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
apps/user-ms/src/main/java/it/pagopa/selfcare/user Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -454,6 +454,7 @@ private Uni<CreateOrUpdateUserByFiscalCodeResponse> createUserOnUserRegistryAndU
454454 Map <String , WorkContactResource > workContacts = new HashMap <>();
455455 workContacts .put (mailUuid , UserUtils .buildWorkContact (userDto .getUser ().getInstitutionEmail ()));
456456 return userRegistryService .saveUsingPATCH (userMapper .toSaveUserDto (userDto .getUser (), workContacts ))
457+ .onFailure (UserUtils ::isConflictOnUserRegistry ).retry ().withBackOff (Duration .ofSeconds (2 )).atMost (3 )
457458 .onFailure ().invoke (exception -> log .error ("Error during create user on userRegistry: {} " , exception .getMessage (), exception ))
458459 .onItem ().invoke (userResource -> log .info ("User created with id {}" , userResource .getId ()))
459460 .onItem ().transform (userResource -> userResource .getId ().toString ())
Original file line number Diff line number Diff line change @@ -142,6 +142,10 @@ public static boolean isUserNotFoundExceptionOnUserRegistry(Throwable fail) {
142142 return fail instanceof WebApplicationException webApplicationException && webApplicationException .getResponse ().getStatus () == HttpStatus .SC_NOT_FOUND ;
143143 }
144144
145+ public static boolean isConflictOnUserRegistry (Throwable fail ) {
146+ return fail instanceof WebApplicationException webApplicationException && webApplicationException .getResponse ().getStatus () == HttpStatus .SC_CONFLICT ;
147+ }
148+
145149 public Optional <String > getMailUuidFromMail (Map <String , WorkContactResource > workContacts , String email ) {
146150 if (Objects .isNull (workContacts ) || workContacts .isEmpty ()) return Optional .empty ();
147151
You can’t perform that action at this time.
0 commit comments