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 6163 posts 24143 karma points MVP 8x 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 2155 posts 14408 karma points MVP 9x 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

Please Sign in or register to post replies

Write your reply to:

Draft