[CLOSED] long-running script

  1. #1

    [CLOSED] long-running script


    I have a DirectMethod-function that executes approx. 5 minutes. Called from javascript it causes that after about 30 seconds browser "freezes". In IE there is a message "xyz is not responding due to a long-running script".
    Finally, when the execution is finished, browser "unfreezes", but this is not user friendly.
    The script saves data from the grid (many rows) to a database and cant be faster.
    Is there a way to avoid this message and browser not-responding?

    Last edited by fabricio.murta; Jan 27, 2016 at 2:50 PM.
  2. #2
    You have two options for this:

    1. Send data by chunks, giving user feedbacks often (segment the upload process, checking for errors every checkpoint)
    2. Set up an asynchronous task as exemplified here: Assynchronous DirectEvents.

    Here are related discussions for further reference:
    - AjaxMethod - is it Asynchronous
    - Asynchronous DirectMethod

    I hope this helps!

    EDIT: This may also bring in some insights on improving performance:
    Long Running Tasks in ASP.NET external blog post by Blake Anderton.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Thanks for the reply.
    I used DirectEvent instead of DirectMethod but it didn't solve the problem. Then I investigated my code and found a funny bug.
    There was a:
    ExtNet.AddScript(this.ID + ".getView().refresh();");
    execuded for each row (on the sever, during the save operation).

    I put the code after the loop and now everyhing works like a charm, even with DirectMethod.
    It looks like previously the grid was saved in 30 seconds and then browser was stuck executing "getView().refresh" houndres of times.
  4. #4
    Yes, glad you found the real culprit of this issue. Refreshing a whole grid for every changed row in a batch change of all rows really is something that would give a lot of strain in the browser, client-side operation.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 1
    Last Post: Nov 01, 2015, 5:23 PM
  2. Replies: 4
    Last Post: Dec 10, 2013, 5:41 PM
  3. Replies: 1
    Last Post: Nov 05, 2012, 8:40 PM
  4. IE Error : Stop running this script?
    By pooja in forum 1.x Help
    Replies: 5
    Last Post: Nov 07, 2011, 7:22 AM
  5. [CLOSED] Update textfield value on a long running process
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 18, 2010, 11:30 AM

Posting Permissions