Copied to clipboard

Flag this post as spam?

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


  • Paul de Quant 403 posts 1520 karma points
    May 31, 2018 @ 08:02
    Paul de Quant
    0

    Delay when publishing a page (via code not backoffice)

    Hello,

    I have a piece of custom code that dynamically creates and publishes a page on a AjaxBeginForm submit.

    The problem I have is that it takes the best part of 22 seconds for the publish to complete and then show a completed message. Is there a way to speed up this publishing process?

    I'm using CreateContentWithIdentity to create the page and PublishWithStatus to publish.

    Many thanks

    Paul

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 31, 2018 @ 15:37
    Alex Skrypnyk
    0

    Hi Paul

    I use ContentService.CreateContent for creation and ContentService.SaveAndPublishWithStatus for publishing and it takes like 1 second to complete on pretty big site.

    Do you have slow db connection maybe? Or server is really not strong enough?

    Thanks,

    Alex

  • Paul de Quant 403 posts 1520 karma points
    May 31, 2018 @ 15:45
    Paul de Quant
    0

    Hi Alex,

    You could very well be right there, I don't think it's a particularly powerful server.

    What is the difference between ContentService.CreateContent and CreateContentWithIdentity?

    Thanks

    Paul

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 31, 2018 @ 15:49
    Alex Skrypnyk
    0

    As documentation said:

    https://our.umbraco.org/documentation/reference/management/services/contentservice#createcontentstring-name-int-parentid-string-contenttypealias-int-userid--0

    CreateContent - Creates a Content object using the alias of the ContentType that this Content is based on.

    CreateContentWithIdentity - Creates and saves an Content object using the alias ContentType that this Content should be based on.

    The difference is in Saving after creation, so basically you save the same content 2 times.

    Try to use "CreateContent" method, it's just creating a content.

    Thanks,

    Alex

  • Paul de Quant 403 posts 1520 karma points
    May 31, 2018 @ 16:01
    Paul de Quant
    0

    No difference I'm afraid took roughly the same amount of time. Maybe it is the server spec.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 31, 2018 @ 16:05
    Alex Skrypnyk
    0

    22 is really to much time.

    What properties are you using?

    MAybe some content events?

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jul 18, 2018 @ 07:38
    Alex Skrypnyk
    0

    Hi Paul

    Did you solve the issue? Can you share with our community?

    Alex

  • Paul de Quant 403 posts 1520 karma points
    Jul 18, 2018 @ 07:40
    Paul de Quant
    0

    I'm afraid not. All I could do was manage the delay, by showing progress wheel and disabling the submit button until the job had finished.

  • Simon Napper 83 posts 253 karma points
    Jul 18, 2018 @ 09:54
    Simon Napper
    0

    Do you have anything hooked into the publish event (or others) that might be slowing it down?

Please Sign in or register to post replies

Write your reply to:

Draft