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

WorkAsync method supporting parallel calls #505

Closed
rappen opened this issue Oct 13, 2016 · 9 comments
Closed

WorkAsync method supporting parallel calls #505

rappen opened this issue Oct 13, 2016 · 9 comments

Comments

@rappen
Copy link
Collaborator

rappen commented Oct 13, 2016

Being able to perform long-running tasks using async behavior introduced by WorkAsync method and WorkAsyncInfo class is great.
But launching several tasks simultaneously causes the yellow info panel to stay on top of the window, even after the last task has completed.
Trying to chain async calls by starting a new task at the end of a PostWorkCallBack method gives the same effect with the info panel.

I hope this could be solved some way to really make use of the possibility to execute tasks async / in the background.
Of course, when simultaneous tasks are running, it might not be obvious which tasks message should be shown in the info panel, but perhaps just showing the last started one is enough.

Note: Except for the problem with the info panel, running async tasks in parallel works just fine using the WorkAsync method!

Perhaps @shytikov or @daryllabar might be able to do something with this? Pretty please? :)

@daryllabar
Copy link
Collaborator

This sounds very similar to #235. Do you have a plugin that has this issue currently I could test with?

@daryllabar
Copy link
Collaborator

I think I see it. There is a single _worker object for the pluginControlBase class. It is not thread safe. But even worse, it only has a single _infoPanel that get's stepped on each time WorkAsync is called. So you call PluginControlBase.WorkAsync() twice in a row, and two panels get created, but when either the first task or second task is completed, it actually closes the second panel, and leaves the first open.

I think the solution is to create a new worker every single time WorkAsync is called, and update SetWorkingMessage to update the most recently created worker.

@daryllabar
Copy link
Collaborator

PR Submitted!

@rappen
Copy link
Collaborator Author

rappen commented Oct 14, 2016

Thanks!!
And yes, very similar to #235. I thought I had reported this before too, but couldn't find it.
Plugin to test with (not public yet, partly due to this problem) https://github.com/Innofactor/XrmToolBox.DateTimeBehaviorUtility

  1. Load Attributes
  2. Check a few of them (more than one)
  3. Click Analyze (top right)

@rappen
Copy link
Collaborator Author

rappen commented Oct 14, 2016

Tried it from my end - initial tests are very positive! 👍

@daryllabar
Copy link
Collaborator

I was able to edit a local plugin to to throw 3 WorkAsync Calls, each taking a second, and it worked just fine.

MscrmTools added a commit that referenced this issue Oct 26, 2016
Fix for WorkAsync method supporting parallel calls #505
rappen pushed a commit to Innofactor/XrmToolBox.DateTimeBehaviorUtility that referenced this issue Oct 26, 2016
@MscrmTools
Copy link
Owner

I guess this has been fixed in November release

@rappen
Copy link
Collaborator Author

rappen commented Nov 15, 2016

October release! :)

@MscrmTools
Copy link
Owner

Yes, my mistake

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

No branches or pull requests

3 participants