question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CalendarView#setupAsync uses GlobalScope

See original GitHub issue

Hello. It’s wrong way to use GlobalScope. Better way is pass CoroutineScope as parameter to CalendarView#setupAsync. For example: fun setupAsync(startMonth: YearMonth, endMonth: YearMonth, firstDayOfWeek: DayOfWeek, coroutineScope: CoroutineScope, completion: Completion? = null)...

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kizitonwosecommented, Aug 29, 2022

In version 1.1.0, a cancellation block is provided to cancel the job. This way Java and Kotlin users can benefit.

1reaction
kizitonwosecommented, Sep 12, 2021

On second thought, I realized it would be better to make the method a suspend function. I am not sure how that would be called from Java, but I know it’s going to get ugly for Java users. Also, that would be a breaking change even for Kotlin users.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The reason to avoid GlobalScope - Roman Elizarov - Medium
It seems that using GlobalScope is a good default for launching work in background, however we do not recommend using GlobalScope . Why?...
Read more >
Why not use GlobalScope.launch? - Stack Overflow
Starting a new coroutine from the global scope using GlobalScope.async or GlobalScope.launch will create a top-level "independent" coroutine.
Read more >
GlobalScope - Kotlin
Global scope is used to launch top-level coroutines which are operating on the whole application lifetime and are not cancelled prematurely.
Read more >
Kotlin Coroutines 1.5: GlobalScope Marked as Delicate ...
Global scope is used to launch top-level coroutines that operate during the whole application lifetime and are not canceled prematurely. Active ...
Read more >
Manual CoroutineScopes: how to avoid GlobalScope
Sometimes you need to run async work outside the View Model. Don't use GlobalScope. Ideally, you should manually create and manage a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found