Announcement

Collapse
No announcement yet.

vB-5.4.3: Hooks: run in parallel?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • vB-5.4.3: Hooks: run in parallel?

    Hello,

    I'm thinking about extending my vB-5.4.3 installation using the hookFrontendContentAfterAdd-hook. Apart from it is not documented: if this hook gets called and the operation defined by my imlementation takes some time to be processed, does the user have to wait for my operation to complete? Or is that done in the background? What is the recommended way to handle such situations?
    I dont want the user to wait for my process to complete...

    Thanks a lot.
    Stefan

  • #2
    I responded to you about this on my site.

    https://vbmods.rocks/forum/vbulletin...using-whatsapp

    GIPHY for vB5 | AutoLinker | Video Attachments Player | Last Registered Users Module | Clear System Cache Cron | Drag-n-Drop Upload | Topic AJAX AutoUpdate | Force Read Topic

    Comment


    • #3
      Hello again,

      I tried pthread + cUrl - but that didn't work out. Now, here's another approach:

      When the page (any page, as far as I know) gets loaded/processed/whatever, vB runs certain processes in the background before or after page usage. This "load" also leads to the various cronjobs defined be run.
      Do you know, how I can add a file/function/hook, such that it will be run, each time the page gets hit?

      I will probably just write the content received by the addContent-hook to the database and let the background process do the actual processing.

      I will also try to add my stuff as a cronjob, but that's just additional (since this would run just every 5 minutes).

      Thanks a lot

      Stefan

      Comment


      • #4
        The Scheduled Task system will only run one task per page load in order to reduce the impact on the end user. If you need to run tools more frequently, we recommend using the vbcron.php file in the do_not_upload folder. Configuration information is in the comments within the file.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud customization and demonstration site.
        vBulletin 5 Documentation - Updated every Friday. Report issues here.
        vBulletin 5 API - Full / Mobile
        I am not currently available for vB Messenger Chats.

        Comment


        • #5
          Wayne,

          that's too rare. My hosting provider lets me run cron just every 5th minute. Which would result in quite extensive waiting times for the message to be delivered.
          Is there a way I can open a (Json, whatever) Interface to the internal site, such that I can call it internally with a async call? Of cource, I can keep it completely outside of vB, but that would make installation a pain.

          And: what do I need to do to add my sender to the list of tasks to be performed at each page load?


          Thanks.
          Stefan

          Comment


          • #6
            You cannot trigger scheduled tasks via AJAX Requests. However, you can perform a proper login via AJAX and send requests to the API from any script. If you extend the API via extensions with a method that you can call, then you would be able to do this via an async call.

            To see how a scheduled task is coded, you would need to look at the scripts in the /core/includes/cron folder. Once you have a script and have uploaded it to that folder, you can add it to the scheduled tasks list via the AdminCP under Scheduled Tasks -> Add New Scheduled Task. If you cannot see the Add New Scheduled Task link, put your site into debug mode.
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud customization and demonstration site.
            vBulletin 5 Documentation - Updated every Friday. Report issues here.
            vBulletin 5 API - Full / Mobile
            I am not currently available for vB Messenger Chats.

            Comment

            Working...
            X