Skip to content
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

locking/unlocking #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

stelcheck
Copy link
Member

Locking and unlocking of topic instances.

cc @ronkorving @AlmirKadric feedback welcome.

Locking and unlocking of topic instances.
@stelcheck
Copy link
Member Author

Question: should we also have a waitForLock API? Seems like it could be convenient, but I fear we might end up with loops that go forever in some edge cases. Recommendations?

/**
* Check if the current topic is locked.
*/
public async isLocked(state: mage.core.IState = new mage.core.State()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about TypeScript, but in ES (afaik) if you return a Promise, you should not mark your function async.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter: if you return a promise on an async call, then that promise will be the promise to be returned.

tslint is currently configured to request that functions returning promises or otherwise using await require the async keyword. I believe this is for readability purposes (e.g. when checking the function signature), but also to make sure that whatever you return is a promise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if that is true for ES as well?

Copy link
Member Author

@stelcheck stelcheck Dec 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants