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

Added setters & getters for lastSuccessfulSync #286

Merged
merged 1 commit into from
May 26, 2024

Conversation

aakarshsingh
Copy link
Contributor

@aakarshsingh aakarshsingh commented May 16, 2024

We found that LSC syncs were spamming our services and explored governing the lastSuccessfulSync using the PullableJndiSrcService and that helped us to reduce the spam on service restarts. At a high-level, this is what we do:

  • Maintain a copy of the lastSuccessfulSync from LSC on Service Shutdown as a configuration in our DB
  • On the restart, the first thing to do would be pull the saved lastSuccessfulSync and set it back using the setter
  • This happens just before the synchorizer kicks in

Rough Use of this approach illustrated below:

final IService service = synchronize.getTask(PersonnelLdapSyncConfiguration.SYNC_TASK_NAME).getSourceService();
if(service instanceof PullableJndiSrcService) {
       PullableJndiSrcService srcService = (PullableJndiSrcService) service;
       Logger.log("LS1 = {0}", srcService.getLastSuccessfulSync());
       srcService.setLastSuccessfulSync(PersonnelLdapSyncConfiguration.getLastSuccessfulSync);
       Logger.log("LS2 = {0}", srcService.getLastSuccessfulSync());
}
LS1 = null
LS2 = Wed May 15 07:00:58 CDT 2024

By governing the lastSuccessfulSync, we are reducing the dataset that it returned to user for Synchronization and that in turn reduces all those extra calls to our internal services.

Added setters & getters for lastSuccessfulSync
@aakarshsingh aakarshsingh changed the title Adder setters & getters for lastSuccessfulSync Added setters & getters for lastSuccessfulSync May 16, 2024
Copy link
Contributor

@rouazana rouazana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello!

Not sure to completely understand your use case, in particular compared to the async facilities already present in the engine (see for example filterAsync on this documentation page).

But I'm fine with your modifications if it helps you!

@aakarshsingh
Copy link
Contributor Author

Yeah, honestly it has been a while since we implemented it internally. But I remember that we were able to control it using filterAsync. The accessors for the lastSuccessfulSync allow us more control through our configuration and service actions.

It will be helpful for us if this gets merged, thanks!

@rouazana rouazana merged commit cba14a0 into lsc-project:master May 26, 2024
1 check passed
@coudot coudot added this to the 2.2 milestone Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants