-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
enhancementNew feature or requestNew feature or requestextensionsPhylum CLI extensionsPhylum CLI extensionsmedium priorityShould be handled as soon as possibleShould be handled as soon as possible
Milestone
Description
Currently, Deno ops (i.e. our Rust-side API) require a Rc<RefCell<OpState>> parameter for handling state. All of our ops are asynchronous, and a user not awaiting on them immediately will cause the RefCell to be mutably borrowed multiple times, which will result in a panic:
Deno.core.print(JSON.stringify(await PhylumApi.get_user_info())) // this will not panic
Deno.core.print(JSON.stringify(PhylumApi.get_user_info())) // this will panicWe need to either leverage some concurrency primitive (e.g. Mutex/RwLock), and make sure it won't ever result in a deadlock, or provide the user with actionable feedback (e.g. "please immediately await Phylum API calls"). Allowing concurrency and favoring more async-friendly interior mutability structures in place of Rc<RefCell<T>> should in general be preferred, but Deno's documentation is currently not super clear on the mechanisms that could cleanly complement that.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestextensionsPhylum CLI extensionsPhylum CLI extensionsmedium priorityShould be handled as soon as possibleShould be handled as soon as possible