fix sync to keycloak
This commit is contained in:
parent
81288f8db3
commit
76fc488d25
3 changed files with 303 additions and 10 deletions
|
|
@ -236,10 +236,31 @@ export class KeycloakSyncController extends Controller {
|
|||
*
|
||||
* @description Syncs profileId and orgRootDnaId to Keycloak for all users
|
||||
* that have a keycloak ID. Uses parallel processing for better performance.
|
||||
*
|
||||
* Features:
|
||||
* - Resume from checkpoint after failures (use resume=true)
|
||||
* - Automatic retry with exponential backoff
|
||||
* - Rate limiting to avoid overwhelming Keycloak
|
||||
* - Progress tracking and persistence
|
||||
*
|
||||
* @param resume - Resume from last checkpoint (default: false)
|
||||
* @param maxRetries - Maximum retry attempts for failed operations (default: 3)
|
||||
* @param rateLimit - Requests per second rate limit (default: 10)
|
||||
* @param clearProgress - Clear existing progress and start fresh (default: false)
|
||||
*/
|
||||
@Post("sync-all")
|
||||
async syncAll() {
|
||||
const result = await this.keycloakAttributeService.batchSyncUsers();
|
||||
async syncAll(
|
||||
@Query() resume: boolean = false,
|
||||
@Query() maxRetries: number = 3,
|
||||
@Query() rateLimit: number = 10,
|
||||
@Query() clearProgress: boolean = false,
|
||||
) {
|
||||
const result = await this.keycloakAttributeService.batchSyncUsers({
|
||||
resume,
|
||||
maxRetries,
|
||||
rateLimit,
|
||||
clearProgress,
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
message: "Batch sync เสร็จสิ้น",
|
||||
|
|
@ -247,6 +268,7 @@ export class KeycloakSyncController extends Controller {
|
|||
success: result.success,
|
||||
failed: result.failed,
|
||||
details: result.details,
|
||||
resumed: result.resumed,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue