Copied to clipboard

Flag this post as spam?

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


  • Matthew 14 posts 84 karma points
    Aug 12, 2018 @ 13:01
    Matthew
    0

    Contentservice api saveandpublish slow ...

    Hi,

    I am finding that contentservice saveandpublish is very slow. Takes around 10+ seconds to complete saving a single content item. Any suggestions on speeding this up ?

    Umbraco 7.6.5

    Thanks Matt

  • Ben Palmer 176 posts 842 karma points c-trib
    Aug 12, 2018 @ 13:06
    Ben Palmer
    0

    Hi Matt,

    Can you post your code where you're calling it? I'm wondering what values you're saving to the content, could potentially be something that's slowing it down?

    Also, I believe SaveAndPublish is obsolete - have a look at swapping this out for SaveAndPublishWithStatus.

    Do you have any slow down when publishing content as normal?

    Thanks,

    Ben

  • Matthew 14 posts 84 karma points
    Aug 14, 2018 @ 09:56
    Matthew
    0

    Hi Ben,

    Thanks for coming back on this. Well, I have actually tried SaveAndPublish as well as SaveAndPublishWithStatus. Sticking with the later. Both seem particularly slow. When publishing from the CMS as normal it doesnt feel overly quick but responds much quicker than through code.

    I call method like this ... using umbraco.core ApplicationContext

    ApplicationContext
                        .Current
                        .Services
                        .ContentService
                        .SaveAndPublishWithStatus(contentItem);
    

    Nothing special about the call. The contentItem contains around 30 properties, just a mix of strings and ints. When I call on my local the operation usually takes around 6-7 seconds. Perhaps this is expected ? .... web server seems slower.

    If I call this (with no publish) it takes around 5 seconds to complete.

            ApplicationContext
                .Current
                .Services
                .ContentService
                .Save(contentItem);
    

    Any suggestions, ideas, hints what might be slowling the process down ? .... ideally it would be lightning fast.

    The item eventually saves and published. However, I also find that the item isn't query able through the index (examine) when looking for it under the root unless I run the SaveAndPublishWithStatus twice. I actually wouldnt mind calling the method twice (not ideal), if it would running through quickly.

    Are there alternate ways to do the above. End of the day I just want to efficiently save and publish a content item programmatically (and see it in the index).

    Any thoughts ? .....

Please Sign in or register to post replies

Write your reply to:

Draft