You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi from OpenSea! We have found an issue when enabling Android's StrictMode. It fails because FileWCSessionStore is doing file I/O on the main thread.
The WCSessionStore's methods are all synchronous, but a store (unless it is purely in-memory) is by nature asynchronous. In general, this means implementations would have to block the current thread while doing either file or network I/O. store() and remove() methods could maybe be implemented as fire-and-forget methods, but then we lose access to Kotlin's built-in structured concurrency.
With the provided FileWCSessionStore implementation, this means we are blocking the main thread while doing file I/O whenever these methods are called. FileWCSessionStore is also doing file I/O on the main thread in its' init block.
The proposed solution would be to make these methods suspend functions. Then, consumers can use their own coroutine scope to run these methods. This does mean that WCSession would need to take in a coroutine scope to launch these new suspend functions from.
The text was updated successfully, but these errors were encountered:
Hey guys,
i see you're trying to improve this library, i have written it from scratch using coroutines, you could try it instead. We're already using it in prod.
Hi from OpenSea! We have found an issue when enabling Android's
StrictMode
. It fails becauseFileWCSessionStore
is doing file I/O on the main thread.The
WCSessionStore
's methods are all synchronous, but a store (unless it is purely in-memory) is by nature asynchronous. In general, this means implementations would have to block the current thread while doing either file or network I/O.store()
andremove()
methods could maybe be implemented as fire-and-forget methods, but then we lose access to Kotlin's built-in structured concurrency.With the provided
FileWCSessionStore
implementation, this means we are blocking the main thread while doing file I/O whenever these methods are called.FileWCSessionStore
is also doing file I/O on the main thread in its'init
block.The proposed solution would be to make these methods
suspend
functions. Then, consumers can use their own coroutine scope to run these methods. This does mean thatWCSession
would need to take in a coroutine scope to launch these new suspend functions from.The text was updated successfully, but these errors were encountered: