Results 1 to 7 of 7

Thread: Unexplained delays

  1. #1
    Join Date
    Jul 2004
    Location
    London UK
    Posts
    1,249

    Default Unexplained delays

    Hi

    I am developing a WebServer interface to allow me to use my iPhone as a remote control (sorry - I think I am retiring NetRemote).

    I have a generic "DoEvent.lhtml" page that lets me trigger arbitrary Girder events via CGI ... e.g.
    Code:
     
    .../DoEvent.lhtml?event=WMC.LiveTV,WMC.2,WMC.Enter
    which triggers the three events in sequence on the Communication Server. In this case, each triggered event is an action which sends a single key to WMC.

    The code for the lhtml page is:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>Do Girder</title>
    <%
     if ( gir ) then
     
      webserver:SetGZIP(false) 
      webserver:SetHeader("Cache-Control: no-cache, must-revalidate")
      webserver:SetHeader("Expires: Fri, 30 Oct 1998 14:19:41 GMT")
     
      local params = webserver:GetCGI()
      local eventlist = params['event']
      gir.LogMessage("DoEvent", eventlist, 0)
      local events = string.Split(eventlist,",")
     
      for k,v in ipairs(events) do
         gir.TriggerEvent( v, '232', nil, nil )
      end
     end 
    %>
    </head>
    <body>
    </body>
    </html>
    It all "works" apart fron unexplained delays that feel like threading deadlock issues broken by time-outs. But the overall unresponsiveness makes it almost unusable.

    The log of the above URL is
    Code:
    Time Date Source Details Payloads
    20:51:38:616 6/1/2010 Enter Sendkey successful.Avid4:\WMC\Controls\Enter
    20:51:34:134 6/1/2010 Communication Server WMC.Enter  
    20:51:38:566 6/1/2010 2 Sendkey successful.Avid4:\WMC\Controls\2
    20:51:29:083 6/1/2010 Communication Server WMC.2  
    20:51:33:607 6/1/2010 LiveTV Sendkey successful.Avid4:\WMC\Controls\LiveTV
    20:51:29:024 6/1/2010 Communication Server WMC.LiveTV  
    20:51:28:951 6/1/2010 DoEvent WMC.LiveTV,WMC.2,WMC.Enter
    There are 4-5 second delays between each triggered Sendkey, which can't be right.

    Any idea what I am doing wrong? Is gir.TriggerEvent the wrong mechanism here? Does it cause unwanted re-entrancy that gets "fixed" by a timeout? Is there a "correct" way of doing this?

    Thanks

    Brian

  2. #2
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,541

    Default

    Let me see,...
    Ron
    No support through PM

  3. #3
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,541

    Default

    Without anything attached to those events, the processing is instantaneous. So it appears the delay is further down. What do the actions do that are attached to the events?
    Ron
    No support through PM

  4. #4
    Join Date
    Jul 2004
    Location
    London UK
    Posts
    1,249

    Default

    Quote Originally Posted by Ron View Post
    Without anything attached to those events, the processing is instantaneous. So it appears the delay is further down. What do the actions do that are attached to the events?
    The actions are trivial -each is a simple keyboard action sending a single character :- *t 1 <ENTER>
    all sending to the "Target Button" specifying "Match foreground task" with "Force Send Keys" unchecked.

    At the time of running, WMC is the foreground process, and the sequence means "Ensure live TV"; "Switch to channel 1".

    I can confirm that when I disable the group of actions, the events trigger in about 50ms.

    I am guessing from your response that my approach is perfectly reasonable.

    Thanks for the help

    Brian

  5. #5
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,541

    Default

    Sounds like the keyboard routines are simply slow for that application. Have to tried measuring how fast they are without triggering them from the web server? Girder needs a little cooperation from the target app to send keys, this is probably causing the slow down. You could try sending to foreground if that is an option, or use the legacy keyboard sending...

    and yes you are going about this in the correct way.
    Ron
    No support through PM

  6. #6
    Join Date
    Jul 2004
    Location
    London UK
    Posts
    1,249

    Default

    Thanks Ron,

    I shall concentrate on "ringing the changes" with the keyboard. I am already sending to foreground. Maybe I can find another automation interface for WMC (SendMessage, maybe even COM) as an alternative. Keyboard was just so easy!

    I've already apparently got rid of some delay by uninstalling MediaBridge as that was hooking into WMC.

    At least now I know what area to concentrate on, so thanks for the pointers - and for the reassurance about use of the lhtml idioms.

    Brian

  7. #7
    Join Date
    Jul 2004
    Location
    London UK
    Posts
    1,249

    Default

    I got it working by changing my DoEvent to a DoKeys with code
    Code:
      local params = webserver:GetCGI()
      local keylist = params['keys']
      gir.LogMessage("DoKeys", keylist, 0)
      gir.SendKeys( nil, keylist)
    This cuts out the TriggerEvent and eliminates one step in the pipeline.

    It now seems pretty instantaneous

    Thanks

    Brian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •