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

Fix: wrong calculation of nextUpdate when setting custom fetchInterval #1206

Merged
merged 1 commit into from
Sep 14, 2024

Conversation

cuong-tran
Copy link
Contributor

it was using the negative value of custom fetchInterval to calculate nextUpdate and causing a nextUpdate date in the past

@@ -107,7 +107,7 @@ class FetchInterval(
interval.absoluteValue.takeIf { interval < 0 }
?: increaseInterval(interval, timeSinceLatest, increaseWhenOver = 10),
)
return latestDate.plusDays((cycle + 1) * interval.toLong()).toEpochSecond(dateTime.offset) * 1000
return latestDate.plusDays((cycle + 1) * interval.absoluteValue.toLong()).toEpochSecond(dateTime.offset) * 1000
Copy link
Member

Choose a reason for hiding this comment

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

Should just fix this inside calculateInterval

Copy link
Contributor Author

@cuong-tran cuong-tran Sep 10, 2024

Choose a reason for hiding this comment

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

calculateInterval is used to automatically calculate the interval based on chapter's release date, when SmartUpdate is set to 'default'.

The case here is when user set a custom SmartUpdate, interval is set to a negative value and used as is, without calling to calculateInterval.

@AntsyLich AntsyLich merged commit 223af55 into mihonapp:main Sep 14, 2024
1 check passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
@cuong-tran cuong-tran deleted the fetchInterval branch October 23, 2024 10:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants