Copied to clipboard

Flag this post as spam?

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


  • Alex Skrypnyk 6182 posts 24284 karma points MVP 9x admin c-trib
    Aug 15, 2022 @ 15:46
    Alex Skrypnyk
    0

    Best Practices Running SaveAndPublish

    Hello, community,

    I'm working on a project where we needed to create and publish many, many nodes, so we're using "SaveAndPublish" which is quite expensive in terms of performance.

    How can we improve the performance of SaveAndPublish?

    Thanks, Alex

  • Marc Goodson 2157 posts 14435 karma points MVP 10x c-trib
    Aug 16, 2022 @ 17:24
    Marc Goodson
    1

    Hi Alex

    I remember a while back in V7 I had this issue, and I think a low tech workaround was to only call 'Save' on the ContentService, and then once my import was complete, 'publish' the section that was imported.

    I'm not sure if this would 'do it' similar in V8 world, but there is a SaveAndPublishBranch method on the ContentService that takes in a content node, and an optional 'force' parameter, that forces everything under that item to be published.

    https://github.com/umbraco/Umbraco-CMS/blob/e626fca2432582f052cb13654eedd9e60ef8723f/src/Umbraco.Core/Services/ContentService.cs#L1941

    so speculating, that using Save each time you create your many many nodes and then at the end call SaveAndPublishBranch... Would that be quicker overall?

    Just a bit of a guess!

    regards marc

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies