-
Notifications
You must be signed in to change notification settings - Fork 28
Add Action Queues concept and modify IDE and project loading to use them #101
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- it's really hard to trace where errors occur, at least like this we can see what the function that errored was. - normally I wouldn't commit something like this, but I think until this all gets cleaned up it's worth having better debuggability.
- this is really just to fix a bad bug where if the user has a project named 'untitled', and for whatever reason that becomes not the 'last opened' one, newProject attempts to create one with the same name which leads to an early error and a broken IDE
- action queues always execute their queued up actions synchronously and in order - dependencies between action queues can be created, to make one wait until another is clear - action queues can also clear their contents if another queue is modified - IDE load and all project init/load functions now schedule their actions inside these action queues, and are also cancellable - this also means the IDE can now receive messages immediately upon loading - they will just be queued until their dependenciees load
|
# Conflicts: # Browser_IDE/editorMain.js
- this is actually how it worked originally, how I change it was a mistake and could cause errors when loading demo projects
- this makes mirroring more tolerant to directories already existing in the executable environment
- really easy now! I like the action queues :P - we should add more tasks for converting everything to use them (should be easy, just needs a fair bit of testing)
14 tasks
- now can really rapidly click to make/destroy projects and not have any errors at all! - key change was making a queue's 'clearOn' targets wait for the other queue to finish cancelling its action (done using new `synchronousWith` concurrency setting) - rationalized `Consume` loop a bit and made the logic clearer - simplified cancellation logic as well - made `projectFromZip` properly cancellable (it was a fluke that it 'cancelled' previously, due to the 'key change' point above) - the Action Queues are still a bit more difficult to wrap one's head around than I wanted, perhaps there's a way to simplifiy this - but the IDE is more stable than ever, so yay!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
SplashKit Online has issues with concurrency, and has a variety of work-arounds in random spots to try and hide them. Rapidly clicking New Project for instance would cause errors, so we have a
makingNewProjectvariable that we use to ignore the button while making a new project. Other similar issues such as loading a project, but clicking New Project mid-way, etc, could all cause issues such as database corruption and a broken IDE. It's also impossible to cancel any operations, including long running ones like loading demo projects.This commit introduces the concept of Action Queues, which as the name suggests gives us synchronous queues in-which to perform actions (such as loading projects, initializing parts of the IDE, etc).
The commit adds a set of default action queues for the current set of actions that can be performed, and modified startup and loading code to use these queues.
This also allows the IDE to begin listening to events from the outside world immediately, as it can just queue up the actions those messages request.
Note: This code isn't very good 😋 I'd really appreciate if someone can review it in detail, or even better offer to finish tidying it up (in which case I'll merge it into a branch you can work off, and that branch can be merged into main once it's tidied).
Type of change
expected)
How Has This Been Tested?
Mostly just spam clicked around. Tested loading projects, new projects, loading demos, switching languages, etc.
Honestly though there are still some minor errors that appear when really abusing the IDE - no worse than before though.Fixed! No errors show up at all now 😄It really needs more testing, and there are a few spots in the code that should be tidied/refactored as well.Also improved, hopefully code quality is alright now anyway...Testing Checklist
Checklist