-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move to async/await. Get rid of callback hell #3540
Comments
I plan to investigate this - I'll look into it and report back in a few days. |
I'm working on this at https://github.com/raybellis/etherpad-lite/tree/async |
Ray has completed the fist stage of his amazing work at https://github.com/raybellis/etherpad-lite/tree/async. The review is being done at https://github.com/raybellis/etherpad-lite/tree/async-PR. That branch is a linear variant of Ray's work, rebased on the latest develop, on which some adaptation are being made. async-PR is a mutable branch, i.e. it will be periodically force-pushed until it is ready to be merged. |
Branch raybellis/async-PR is now deployed on https://beta.etherpad.org/ to allow widespread testing. It will be periodically updated while the branch is audited. |
Please note that I've added a couple of extra commits to the |
Thanks, imported. I am (slowly) going through the series, trying to:
This will take some time. |
Clarification request/question: From the above I understand that the branch https://github.com/raybellis/etherpad-lite/tree/async-PR is now stable enough to try and test it on own instances. Is my view correct? |
Hi @Wikinaut, yes please, test as much as you can. Any info is welcome to help polishing this branch. @raybellis: is it possible to write here a brief list of known issues, if any? |
Next version will be Etherpad 1.8. As planned in #3424, we are going to require NodeJS >=8.9.0 and npm >= 6.4. This commit implements that change and updates documentation and scripts. Subsequent changes will get rid of old idioms, dating back to node < 0.7, that still survive in the code. Once migrated to NodeJS 8, we will be able to start working on migrating the code base from callbacks to async/await, greatly simplifying legibility (see #3540). Closes #3557
@muxator The only issue I'm currently aware of is a possible problem (to be confirmed) with importing ".etherpad" format files. |
Yeah, the
BTW, I am frequently seeing another "author-related" error both in the beta and locally:
|
The first one is easily fixed (commit c5a633d in my async branch). I don't know what I was thinking there, but the double assignment of The second one is going to require more investigation. padMessageHandler was one of the harder modules to convert, and I expect this bug only becomes evident if there are multiple users editing a pad. |
I can't see how to replicate the |
A recap of the issues so far:
|
I think I found the problem with Removing a I have committed the change in The fix uncovers another possible bug. Details in #3540 (comment) to keep everything in a single palce. |
[UPDATE: this is solved now in a newer branch] @raybellis @muxator I have now setup my test server using raybellis/async 39b0c7e (and before, I tried, raybellis/async-PR https://github.com/raybellis/etherpad-lite/commit/4bf1a434d44c792850bb643a9b2c04d78c65af42 ) branch. Both branches currently fail to load a page. Let me know, when you have some news.
|
Integrated in async-PR with the original change that touched SecurityManager.js and some related functions (ee03456#diff-5d2aa4336c4964b828a123e20e09b73cR1230), and deployed on beta. I never encountered that error, btw. Thanks to @Wikinaut's testing. |
@raybellis Confirmed, f8a26cb works! Thank you. I see one error:
|
And I see
This Error is also present in the callback version. |
I think this is #3472. |
I am now checking the compatibility with my plugins; I will present a list of the working plugins soon, but this is not working, perhaps @raybellis can you have a look, why "small_list" appears not to work with the async branch? |
@Wikinaut I'll take a look, but my suspicion is that 1.8 will be incompatible with most (if not all) existing plugins because none of the exposed functions take a final See, for example, the way that |
This is probably worh a dedicated issue. @raybellis, could you open one with a brief description so we can keep track of it? [edit]: the issue regarding dealing with plugin compatibility was opened by Ray at #3566. A possible solution is 4fdc73cdc47829fcb19f3e82c878a5f94e00f0d, which as of 2019-03-03 is still not integrated into async-PR because I did not understand if it is definitive or not. |
Are you interested in the list of my plugins which run (on the async version) without apparent issues? |
Back-end test failures with the SessionManager on the async branches were mentioned (and resolved) at #3567 (comment) |
It's done. See #3559 (comment). |
Currently (1.8pre), Etherpad code base is heavily based on callbacks. While this made sense at the time (~2011) JS ecosystem has moved forward, and better solutions exist.
We should investigate the possibility of migrating the code base to an
async/await
paradigm, in order to make the code easier on the eye of future contributors.This move was anticipated in #3424. It is now time to start discussing it concretely.
As usual, the first concern is maintaining stability: this change is going to be wide, but should be as shallow as possible, ideally not containing any new functionality work. After this, hopefully the code base will be easier to reason about, less buggy, and new features will be easier to implement.
Edit: the Pull Request that implements this change is #3559.
The text was updated successfully, but these errors were encountered: