Skip to content

Conversation

@Ayyanchira
Copy link
Member

@Ayyanchira Ayyanchira commented May 12, 2021

🔹 Jira Ticket(s) if any

https://iterable.atlassian.net/browse/MOB-2899

✏️ Description

  1. Dont schedule for offline processing if row count exceeds max allowed number
  2. Max offline operation is set to 1000
  3. Added tests for Healthmonitoring and offline processing
  4. DB error checks and fallback logic

@Ayyanchira Ayyanchira force-pushed the MOB-2899-OnlineRequestProcessor-when-DB-exceeds-maxcount branch 2 times, most recently from 757597c to 4f0bd2d Compare May 12, 2021 16:01
1. Dont schedule for offline processing if row count exceeds max allowed number
2. Max offline operation is set to 1000
3. Added mock task storage in initializer for testing
@Ayyanchira Ayyanchira force-pushed the MOB-2899-OnlineRequestProcessor-when-DB-exceeds-maxcount branch from 4f0bd2d to 09e81a7 Compare May 12, 2021 16:18
@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #345 (8c62628) into master (05e5c95) will decrease coverage by 1.12%.
The diff coverage is 52.38%.

❗ Current head 8c62628 differs from pull request most recent head e32b4b5. Consider uploading reports for the commit e32b4b5 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #345      +/-   ##
==========================================
- Coverage   70.57%   69.45%   -1.13%     
==========================================
  Files          60       61       +1     
  Lines        3715     3765      +50     
  Branches      433      438       +5     
==========================================
- Hits         2622     2615       -7     
- Misses        828      895      +67     
+ Partials      265      255      -10     
Impacted Files Coverage Δ
...va/com/iterable/iterableapi/IterableConstants.java 0.00% <ø> (ø)
.../com/iterable/iterableapi/IterableTaskStorage.java 8.37% <18.51%> (-15.02%) ⬇️
...a/com/iterable/iterableapi/IterableTaskRunner.java 64.36% <40.00%> (-1.90%) ⬇️
...n/java/com/iterable/iterableapi/HealthMonitor.java 78.94% <78.94%> (ø)
.../iterable/iterableapi/OfflineRequestProcessor.java 81.03% <91.66%> (-1.32%) ⬇️
...in/java/com/iterable/iterableapi/IterableUtil.java 65.17% <0.00%> (-5.36%) ⬇️
...in/java/com/iterable/iterableapi/IterableTask.java 40.00% <0.00%> (-3.34%) ⬇️
...terableapi/IterableNetworkConnectivityManager.java 33.33% <0.00%> (-2.78%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05e5c95...e32b4b5. Read the comment docs.

@Ayyanchira Ayyanchira marked this pull request as draft May 12, 2021 16:32
@Ayyanchira Ayyanchira requested review from roninopf and vbabenkoru May 12, 2021 16:32
@Ayyanchira Ayyanchira changed the title [MOB-2899] - Health Montoring for Offline Processor [MOB-2899] - Health Monitoring for Offline Processor May 12, 2021
@roninopf roninopf changed the base branch from master to MOB-2854-health-monitor May 12, 2021 18:16
roninopf and others added 7 commits May 12, 2021 17:09
1. Healthmonitor now access Iterable task storage to directly access db and to understand if its ready
2. Introducing Healthmonitorhandler with idea that whoever subscribes to healthmonitor (in our case Taskrunner), should understand if something goes wrong and make it immediately switch to online. This is not implemented yet
3. IterableTaskStorageHandler (may be not a good idea. Might have to remove this)
1. Interface at IterableTaskStorage which will notify all DB errors to Healthmonitor. This will be used by healthmonitor to keep its flag 'errored' updated.
2. canSchedule and canProcess will now be checked through this flag in healthmonitor
3. Updated existing test methods which were failing because of this changes as it needed healthmonitoring mock in them
4. Made some improvements where healthmonitor was being initialized reperatedly.

Still pending:
1. should canProcess and canSchedule be based on just one flag - errored in healthMonitor?
2. Is there a technique to switch back to offline mode? after we set errored flag to true?
@Ayyanchira Ayyanchira force-pushed the MOB-2899-OnlineRequestProcessor-when-DB-exceeds-maxcount branch from 8f3949c to d5801fe Compare May 18, 2021 17:10
roninopf and others added 5 commits May 19, 2021 14:08
1. DB method numberOfTasks now throws exception. Although we can still add exception handling in other methods in TaskStorage as well, this should cover it all. This should suffice as it internally checks for if the database is ready and throws an exception if its not. This method is also called during canSchedule which makes it a busy node for every request being made during offline request processing.
2. Added test method for canSchedule. Canprocess test is still pending
@Ayyanchira Ayyanchira force-pushed the MOB-2899-OnlineRequestProcessor-when-DB-exceeds-maxcount branch 7 times, most recently from 329cdb7 to 3a3cc94 Compare May 24, 2021 21:17
@Ayyanchira Ayyanchira force-pushed the MOB-2899-OnlineRequestProcessor-when-DB-exceeds-maxcount branch 3 times, most recently from 0906eb8 to 2161969 Compare May 25, 2021 15:14
1. DB initialization was taking wrong context instead of the one passed into it.
2. Above change enabled writing test for healthMonitor's canProcess function.
3. getRemoteCongifuration now looks for "SDKOfflineModeBeta" instead of "offlineModeBeta" to enable offline mode
4. Reverting back to our previous implementation of apiclient where we dont have different requestProcessor in apiclient. It will remain abstract in apiclient layer
@Ayyanchira Ayyanchira force-pushed the MOB-2899-OnlineRequestProcessor-when-DB-exceeds-maxcount branch from 2161969 to 7525fb2 Compare May 25, 2021 16:19
@Ayyanchira Ayyanchira marked this pull request as ready for review May 25, 2021 16:54
@Ayyanchira Ayyanchira requested a review from davidtruong May 25, 2021 17:09
@roninopf roninopf changed the base branch from MOB-2854-health-monitor to master May 25, 2021 20:16
@Ayyanchira Ayyanchira force-pushed the MOB-2899-OnlineRequestProcessor-when-DB-exceeds-maxcount branch from 3102b30 to 102e5be Compare May 27, 2021 18:29
Copy link
Contributor

@davidtruong davidtruong left a comment

Choose a reason for hiding this comment

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

LFTM

Adding suggested changes from PR reviews
Also added error check while creatin-> inserting task into DB
@Ayyanchira Ayyanchira force-pushed the MOB-2899-OnlineRequestProcessor-when-DB-exceeds-maxcount branch from 102e5be to e32b4b5 Compare May 27, 2021 19:18
@Ayyanchira Ayyanchira merged commit 9ba4711 into master May 27, 2021
@Ayyanchira Ayyanchira deleted the MOB-2899-OnlineRequestProcessor-when-DB-exceeds-maxcount branch May 27, 2021 21:09
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.

5 participants