-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove a deadcode - the error
variable will never be an AFError
#22398
Conversation
[`Media.error`][Link] is an `NSError` instance. The casting here `error as? AFError` always fails. [Link]: https://github.com/wordpress-mobile/WordPress-iOS/blob/23.9/WordPress/Classes/Models/Media.m#L215
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
@iangmaia FYI, when I opened this PR, the dangermattic GHA says "it's cancelled". And I have to go to the GHA and re-run the job. Not sure if this is a known issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have grabbed all 1627 events from the Sentry issue and find only one 'AFError' occurrence.
A post on how you did this would be interesting. Nudge nudge.
Media.error is an NSError instance. The casting here error as? AFError always fails.
The fact that Alamofire is on its way out adds to the safety of merging this.
Hi @crazytonyli, thanks for the ping. Yeah, I've also noticed it -- I've configured this GHA to cancel in progress executions if there's a new one, and that apparently triggers a notification for each job that has been cancelled. There's no need to re-run it manually as there's always a new job that will run when the former one is cancelled. I've been thinking about how to deal with it -- perhaps we'd be ok by not cancelling in-progress jobs, or grouping their parallel execution in a different way (I currently group them by branch). I'll continue looking into it. |
@mokagio I just wrote a simple ruby script that calls an Sentry API to iterate all the associated events in the issue. I don't feel like it's P2-worthy 🥲 |
I feel like it is 😄
|
Media.error
is anNSError
instance. The casting hereerror as? AFError
always fails.Tests
I didn't do any testing, because I'm pretty sure the deleted code is deadcode—it never runs in the app.
Second, I have verified the chance that the
error
is originally anAFError
is pretty low: 1 out of 1627. So, it'd be low impact if go one step further and stop checkingAFError
.The apps send events to Sentry when
hasMissingFileError
(which is where the deleted code resides) is true. All of these events are associated with this Sentry issue #15096.WordPress-iOS/WordPress/Classes/Services/MediaCoordinator.swift
Lines 788 to 794 in a464f7c
I have grabbed all 1627 events from the Sentry issue and find only one 'AFError' occurrence.
Regression Notes
Potential unintended areas of impact
None.
What I did to test those areas of impact (or what existing automated tests I relied on)
None. See the "Tests" section for reasons.
What automated tests I added (or what prevented me from doing so)
None.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.UI Changes testing checklist: N/A