Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18630

Re: Strange Delay in Page display (OT ??)

From Christoph Becker <cmbecker69@gmx.de>
Newsgroups comp.lang.javascript
Subject Re: Strange Delay in Page display (OT ??)
Date 2013-02-25 22:43 +0100
Organization Aioe.org NNTP Server
Message-ID <kggls7$k5d$1@speranza.aioe.org> (permalink)
References (1 earlier) <d1d0ecaf-e553-4c98-b3c8-0c14a9af8372@googlegroups.com> <aonu3hFt8h4U1@mid.individual.net> <aonuqaFtcusU1@mid.individual.net> <ufzWs.14885$Zp1.6558@en-nntp-15.dc1.easynews.com> <ap1vtuF4pd1U1@mid.individual.net>

Show all headers | View raw


Mel Smith wrote:

>     So, I guess that *sending* both emails by my sendmail() function in my 
> server somehow either ties up my CGI app, or ties up my Apache server 
> software, and slows one or both down until my sendmail() function is 
> completed.
>
>    I'll have to find a way to somehow lower the priority of the
> sendmail so it doesn't slow things down.

I suppose that your sendmail() function works synchronously.  If so, the
script will only continue after the mail was sent, and lowering the
process priority of sendmail will only slow things down more.

You might consider to call setupflds() directly after all the respective
elements were sent to the browser (flushing the buffer is reasonable, as
Richard wrote), but before you call sendmail().

A simplified example in a fictious language:

  print '<input id="hscrname" ...>'
  print '<input id="iscrname" ...>'
  print '<script type="text/javascript">setupflds()</script>'
  flush
  sendmail()

Of course this won't fit with a clean separation of model and view, so
another possibility might be to send the mail asynchronously, e.g. by
writing it to a queue which will be processed independently.

-- 
Christoph M. Becker

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-21 11:31 -0700
  Re: Strange Delay in Page display (OT ??) Danny <dann90038@gmail.com> - 2013-02-21 15:42 -0800
    Re: Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-21 17:57 -0700
      Re: Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-21 18:09 -0700
        Re: Strange Delay in Page display (OT ??) Richard Damon <Richard@Damon-Family.org> - 2013-02-24 20:37 -0500
          Re: Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-25 13:29 -0700
            Re: Strange Delay in Page display (OT ??) Christoph Becker <cmbecker69@gmx.de> - 2013-02-25 22:43 +0100
              Re: Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-25 16:41 -0700

csiph-web