Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sergio 73 posts 93 karma points
    Oct 17, 2011 @ 12:15
    Sergio
    0

    Problems with MultiThreading

    Hello,

    I need to execute some parts of my code in a new thread to improve the performance and the user experience but some of the umbraco.library methods are not working when I execute them in a new thread.

    Example: umbraco.library.GetCurrentDomains or umbraco.library.GetNiceUrl

    I suppose the problem is that the new thread lose the Umbraco context. Is there any way to create manually the context? Or any other idea?

  • Mikkel Johansen 116 posts 292 karma points
    Sep 23, 2015 @ 19:56
    Mikkel Johansen
    0

    Hi Sergio

    Did you find a solution?

    I have the exact same problem.

  • James Jackson-South 489 posts 1747 karma points c-trib
    Sep 24, 2015 @ 00:00
    James Jackson-South
    0

    Hey guys,

    You could pass an UmbracoHelper instance to your asynchronous method that could be used for retrieving the NiceUrl and NiceUrlWithDomain methods. That would give the thread something to use.

    As far as umbraco.library.GetCurrentDomains goes, I don't know what you are using the method for so I don't know what to offer as a workaround. What I can tell you though is that the Domain class that the method used is marked as obsolete in the source on Github so I'm presuming they don't want you to use it.

    https://github.com/umbraco/Umbraco-CMS/blob/0cca63e6468e02c42bc0f227fff5995c2373f4c8/src/umbraco.cms/businesslogic/web/Domain.cs#L24

    Looks like a new IDomainService is coming instead for v7.3

Please Sign in or register to post replies

Write your reply to:

Draft