a timed event in asp.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Larry Bud

    a timed event in asp.net

    With the help of some of you guys, we're making progress here.

    I have a webservice that outputs a file which another apps picks up.
    I write a row to SQL that has some status flags of this output file.

    The other apps processes this file, and will set the status in one of
    the columns to true when the output file IT created is ready.

    So in my webservice, I want to check every, oh, maybe 1/2 sec to see
    when the processing app is done. However, I want to time out after
    about 10 seconds.

    What's the best way to do a loop that will execute a function, but
    only execute this function until it returns TRUE or the elapsed time
    is done? I can obviously take current time, but is there other timer
    functions that I should use?
  • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

    #2
    RE: a timed event in asp.net

    there are two approaches

    1) check the timeout/cancel flag. this is easy if there is a loop, less if
    not. this approach is also difficult if there are calls to code that may not
    return in the timeout.

    2) use a watchdog thread. this is a second thread that starts a timer, and
    aborts the processing thread if not completed in time. at completion the
    process thread would cancel the watchdog. this makes the processing thread
    easy to code, but the watchdog takes a little work.

    you have a trival polling loop, so I'd do #1. with a little work, you could
    have one polling thread that does the work for all concurrent requests.

    -- bruce (sqlwork.com)


    "Larry Bud" wrote:
    With the help of some of you guys, we're making progress here.
    >
    I have a webservice that outputs a file which another apps picks up.
    I write a row to SQL that has some status flags of this output file.
    >
    The other apps processes this file, and will set the status in one of
    the columns to true when the output file IT created is ready.
    >
    So in my webservice, I want to check every, oh, maybe 1/2 sec to see
    when the processing app is done. However, I want to time out after
    about 10 seconds.
    >
    What's the best way to do a loop that will execute a function, but
    only execute this function until it returns TRUE or the elapsed time
    is done? I can obviously take current time, but is there other timer
    functions that I should use?
    >

    Comment

    • Patrice

      #3
      Re: a timed event in asp.net

      I'm not really sure to understand the overall process but I would just
      notify the webservice using another call :
      - the "other app" calls the webservice to get a file
      - the "other app" process this file to create a "processed file" (at a
      location that is shared with the web service ?)
      - the "other app" calls the same webservice to notify the webservice that
      the "processed file" is ready

      --
      Patrice

      "Larry Bud" <larrybud2002@y ahoo.coma écrit dans le message de news:
      a5a0b5d3-16a9-4451-96f5-b8d7f463c659...l egroups.com...
      With the help of some of you guys, we're making progress here.
      >
      I have a webservice that outputs a file which another apps picks up.
      I write a row to SQL that has some status flags of this output file.
      >
      The other apps processes this file, and will set the status in one of
      the columns to true when the output file IT created is ready.
      >
      So in my webservice, I want to check every, oh, maybe 1/2 sec to see
      when the processing app is done. However, I want to time out after
      about 10 seconds.
      >
      What's the best way to do a loop that will execute a function, but
      only execute this function until it returns TRUE or the elapsed time
      is done? I can obviously take current time, but is there other timer
      functions that I should use?

      Comment

      Working...