Skip to content

Commit

Permalink
fix: change order of updates to make it idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
tkuzynow committed May 14, 2024
1 parent de5eee1 commit 17bf384
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public void execute(Database database) {
adviceSeekerTenant.getUserId(),
adviceSeekerTenant.getTenantId());

keycloakUserService.updateUserCustomAttribute(
"tenantId", adviceSeekerTenant.getTenantId(), adviceSeekerTenant.getUserId());

userServiceJdbcTemplate.update(
"UPDATE user SET tenant_id = ? WHERE user_id = ?",
adviceSeekerTenant.getTenantId(),
Expand All @@ -73,8 +76,6 @@ public void execute(Database database) {
adviceSeekerTenant.getTenantId(),
adviceSeekerTenant.getUserId());

keycloakUserService.updateUserCustomAttribute(
"tenantId", adviceSeekerTenant.getTenantId(), adviceSeekerTenant.getUserId());

log.info(
"Successfully set tenantId for {} with id {} to {}",
Expand Down

0 comments on commit 17bf384

Please sign in to comment.