Skip to content

Better setup / teardown for JobService #745

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

Merged
merged 2 commits into from
Oct 10, 2017

Conversation

natario1
Copy link
Contributor

@natario1 natario1 commented Sep 20, 2017

We don't rely anymore on onCreate / onDestroy to set up and tear down the job service. The service executes jobs in a separate thread so onDestroy is called before we would expect.

Fixes #744

@codecov
Copy link

codecov bot commented Sep 20, 2017

Codecov Report

Merging #745 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #745      +/-   ##
============================================
- Coverage     53.39%   53.38%   -0.02%     
  Complexity     1746     1746              
============================================
  Files           132      132              
  Lines         10284    10286       +2     
  Branches       1426     1427       +1     
============================================
  Hits           5491     5491              
- Misses         4338     4340       +2     
  Partials        455      455
Impacted Files Coverage Δ Complexity Δ
...arse/src/main/java/com/parse/PushServiceApi26.java 0% <0%> (ø) 0 <0> (ø) ⬇️

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 2b7bb5b...ee4e62b. Read the comment docs.

@Jawnnypoo
Copy link
Member

Maybe I am missing something, but it looks like no matter what, in the finally block, we are saying the job is done and calling jobFinished(jobParameters, false);. Shouldn't this true/false be dependent on if the push was a success or not? Otherwise, the push could fail, and we would never reschedule the push to retry

@natario1
Copy link
Contributor Author

@Jawnnypoo by success you mean that handler.handlePush() does not throw?

@Jawnnypoo
Copy link
Member

Yeah, it seems like there, we should be checking to see if an exception was thrown by the handler, and if so, reschedule. But maybe that is incorrect thinking, since more than likely the only reason a push would fail would be cases where it would always fail, and it should therefore not be rescheduled.

@natario1
Copy link
Contributor Author

I got it, I think your second scenario makes sense. handler.handle() never reaches developer code, it is our own stuff. So if that throws there's something wrong with our handlers and we would end in a schedule loop

@Jawnnypoo
Copy link
Member

Makes sense 👍

@Jawnnypoo Jawnnypoo self-requested a review September 20, 2017 20:33
@Jawnnypoo
Copy link
Member

Is there something we can do about this codecov thing?

@natario1
Copy link
Contributor Author

@Jawnnypoo not easily. I had made a PushService26Test for one of these PRs, but then discarded because it requires Oreo, and we currently can't run Oreo tests due to Robolectric issues. I don't remember the exact reason right now but I can take a look

@natario1
Copy link
Contributor Author

I have been playing with androidTests recently, that would solve a couple issues, but running them on Travis has been quite painful

@rogerhu
Copy link
Contributor

rogerhu commented Oct 10, 2017

I'm seeing issues in the current branch...sometimes the push handler crashes because handler is null.

@Jawnnypoo
Copy link
Member

@rogerhu Are you seeing this in the tests, or in an app using the latest?

@rogerhu
Copy link
Contributor

rogerhu commented Oct 10, 2017

In the app. Let's merge and tag release. I will do more digging to understand what the issue is.

@rogerhu rogerhu merged commit 300c3ec into parse-community:master Oct 10, 2017
@natario1 natario1 deleted the tear-pushservice26 branch October 10, 2017 17:25
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