replace GlobalScope with CoroutineScope in CacheController
All checks were successful
continuous-integration/woodpecker the build was successful
All checks were successful
continuous-integration/woodpecker the build was successful
This commit is contained in:
parent
f49e600613
commit
a52c17e98d
@ -156,7 +156,7 @@ class CacheController {
|
|||||||
* this function updates the courseList
|
* this function updates the courseList
|
||||||
* during the update process the old data will be returned for an API request
|
* during the update process the old data will be returned for an API request
|
||||||
*/
|
*/
|
||||||
private fun asyncUpdateCourseList() = GlobalScope.launch {
|
private fun asyncUpdateCourseList() = CoroutineScope(Dispatchers.IO).launch {
|
||||||
CourseListParser().getCourseLinks(StartupController.courseListURL)?.let {
|
CourseListParser().getCourseLinks(StartupController.courseListURL)?.let {
|
||||||
courseList = CoursesList(CoursesMeta(System.currentTimeMillis() / 1000, it.size), it.toSortedMap())
|
courseList = CoursesList(CoursesMeta(System.currentTimeMillis() / 1000, it.size), it.toSortedMap())
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ class CacheController {
|
|||||||
* this function updates the mensa menu list
|
* this function updates the mensa menu list
|
||||||
* during the update process the old data will be returned for an API request
|
* during the update process the old data will be returned for an API request
|
||||||
*/
|
*/
|
||||||
private fun asyncUpdateMensa() = GlobalScope.launch {
|
private fun asyncUpdateMensa() = CoroutineScope(Dispatchers.IO).launch {
|
||||||
val mensaCurrentWeek = MensaParser().getMensaMenu(StartupController.mensaMenuURL)
|
val mensaCurrentWeek = MensaParser().getMensaMenu(StartupController.mensaMenuURL)
|
||||||
val mensaNextWeek = MensaParser().getMensaMenu(MensaParser().getMenuLinkNextWeek(StartupController.mensaMenuURL))
|
val mensaNextWeek = MensaParser().getMensaMenu(MensaParser().getMenuLinkNextWeek(StartupController.mensaMenuURL))
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ class CacheController {
|
|||||||
* during the update process the old data will be returned for an API request
|
* during the update process the old data will be returned for an API request
|
||||||
* a FixedThreadPool is used to make parallel requests for faster updates
|
* a FixedThreadPool is used to make parallel requests for faster updates
|
||||||
*/
|
*/
|
||||||
private fun asyncUpdateTimetables() = GlobalScope.launch {
|
private fun asyncUpdateTimetables() = CoroutineScope(Dispatchers.IO).launch {
|
||||||
logger.info("Updating ${timetableList.size} timetables ...")
|
logger.info("Updating ${timetableList.size} timetables ...")
|
||||||
|
|
||||||
// create a new ThreadPool with 5 threads
|
// create a new ThreadPool with 5 threads
|
||||||
|
Loading…
Reference in New Issue
Block a user