Various improvements #17

Merged
Seil0 merged 11 commits from :fix/timeout-resilience into master 2021-10-24 14:38:13 +02:00
Collaborator

While this pull request also includes some small improvements, the main change can be found in the Timetable fixes commit.

As of now, the weekNumberYear didn't get updated through the scheduled updates. Also, if a timeout occurs on the scheduled update, the existing data is overwritten. I don't see a good reason for that. That's why I changed it accordingly.

While this pull request also includes some small improvements, the main change can be found in the Timetable fixes commit. As of now, the weekNumberYear didn't get updated through the scheduled updates. Also, if a timeout occurs on the scheduled update, the existing data is overwritten. I don't see a good reason for that. That's why I changed it accordingly.
hannesbraun added 7 commits 2021-10-13 16:44:24 +02:00
cf979df46e
Timetable fixes
- Only one request is made to get the timetable HTML document for parsing the timetable and the weekNumberYear
- On timeouts or other errors, the cached data won't be overwritten with emptiness anymore
- The scheduled updates will now also update the weekNumberYear
c5916c65ae
Dependency updates
This also replaces JCenter with Maven Central since JCenter is now read-only
f98dc3d808
Small improvements
- Improve formatting
- Fix some typos
- Mini code improvements
Owner

please rebase onto master

please rebase onto master
hannesbraun force-pushed fix/timeout-resilience from f98dc3d808 to 6f4cb9fd66 2021-10-13 22:22:22 +02:00 Compare
hannesbraun added 1 commit 2021-10-14 00:32:36 +02:00
e7b5eff04b
Use ConcurrentHashMap for timetableList
Multiple requests may be processed at the same time and could otherwise cause problems (concurrent write operations)
hannesbraun added 1 commit 2021-10-15 20:08:11 +02:00
235cc7f773
Limit sending timetable requests in parallel to 3
Otherwise, the requests may fail (from my experience). Also we don't want to look suspicious (flooding their server with tons of requests at the same time).
hannesbraun added 1 commit 2021-10-16 01:08:59 +02:00
Seil0 requested changes 2021-10-23 12:58:05 +02:00
@ -35,0 +42,4 @@
val semaphore = Semaphore(3, 0)
}
private val htmlDoc: Document? =
Owner

please us ?.let { ... } for null safety. Something like this:

private val htmlDoc: Document? = htmlDoc ?: timetableURL?.let {
    runBlocking {
        ...
    }
}
please us `?.let { ... }` for null safety. Something like this: ```kotlin private val htmlDoc: Document? = htmlDoc ?: timetableURL?.let { runBlocking { ... } } ```
Author
Collaborator

This should be fixed with ca14a5d2f6

This should be fixed with ca14a5d2f6
hannesbraun marked this conversation as resolved
hannesbraun added 1 commit 2021-10-23 13:50:20 +02:00
Seil0 approved these changes 2021-10-23 13:56:07 +02:00
Seil0 left a comment
Owner

lgtm

lgtm
hannesbraun added 11 commits 2021-10-24 14:34:33 +02:00
22f17d10e0
Timetable fixes
- Only one request is made to get the timetable HTML document for parsing the timetable and the weekNumberYear
- On timeouts or other errors, the cached data won't be overwritten with emptiness anymore
- The scheduled updates will now also update the weekNumberYear
a292b45fcb
Dependency updates
This also replaces JCenter with Maven Central since JCenter is now read-only
993b8f6a71
Small improvements
- Improve formatting
- Fix some typos
- Mini code improvements
fb6291792d
Use ConcurrentHashMap for timetableList
Multiple requests may be processed at the same time and could otherwise cause problems (concurrent write operations)
8e3af696e0
Limit sending timetable requests in parallel to 3
Otherwise, the requests may fail (from my experience). Also we don't want to look suspicious (flooding their server with tons of requests at the same time).
Seil0 merged commit dc57a0d0c1 into master 2021-10-24 14:38:13 +02:00
Sign in to join this conversation.
No description provided.