Github user avikganguly01 commented on a diff in the pull request:
https://github.com/apache/fineract/pull/118#discussion_r143807826
--- Diff:
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java
---
@@ -37,42 +40,66 @@
private final SavingsAccountAssembler savingAccountAssembler;
private final SavingsAccountWritePlatformService
savingsAccountWritePlatformService;
- private final SavingsAccountRepository savingAccountRepository;
private final SavingsAccountReadPlatformService
savingAccountReadPlatformService;
@Autowired
public SavingsSchedularServiceImpl(final SavingsAccountAssembler
savingAccountAssembler,
final SavingsAccountWritePlatformService
savingsAccountWritePlatformService,
- final SavingsAccountRepository savingAccountRepository,
final SavingsAccountReadPlatformService
savingAccountReadPlatformService) {
this.savingAccountAssembler = savingAccountAssembler;
this.savingsAccountWritePlatformService =
savingsAccountWritePlatformService;
- this.savingAccountRepository = savingAccountRepository;
this.savingAccountReadPlatformService =
savingAccountReadPlatformService;
}
- @CronTarget(jobName = JobName.POST_INTEREST_FOR_SAVINGS)
- @Override
- public void postInterestForAccounts() throws JobExecutionException {
- final List<SavingsAccount> savingsAccounts =
this.savingAccountRepository.findSavingAccountByStatus(SavingsAccountStatusType.ACTIVE
- .getValue());
- StringBuffer sb = new StringBuffer();
- for (final SavingsAccount savingsAccount : savingsAccounts) {
- try {
-
this.savingAccountAssembler.assignSavingAccountHelpers(savingsAccount);
-
this.savingsAccountWritePlatformService.postInterest(savingsAccount);
- } catch (Exception e) {
- Throwable realCause = e;
- if (e.getCause() != null) {
- realCause = e.getCause();
- }
- sb.append("failed to post interest for Savings with id " +
savingsAccount.getId() + " with message "
- + realCause.getMessage());
- }
- }
-
- if (sb.length() > 0) { throw new
JobExecutionException(sb.toString()); }
- }
+ @Transactional
+ @CronTarget(jobName = JobName.POST_INTEREST_FOR_SAVINGS)
+ @Override
+ public void postInterestForAccounts() throws JobExecutionException {
+ final int maxPazeSize = 100;
+ boolean hasErrorOccurred = false;
+ int offSet = 1;
--- End diff --
Offset should be 0
---