surrealdb / surrealdb.js

SurrealDB SDK for JavaScript
https://surrealdb.com
Apache License 2.0
271 stars 46 forks source link

Engine should handle closing the connection #279

Closed kearfy closed 4 weeks ago

kearfy commented 4 weeks ago

Thank you for submitting this pull request! We appreciate you spending the time to work on these changes.

What is the motivation?

The close method does not work nicely with embedded databases, because the wasm library does not emit disconnect events onto the event emitter. The engine should handle closing the connection instead

What does this change do?

The engine now awaits the disconnected message and will resolve the promise

What is your testing strategy?

CI

Is this related to any issues?

Yes, though no issue on GitHub was previously created.

Have you read the Contributing Guidelines?