Skip to main content
Inspiring
June 26, 2006
Question

Slowing Down a CFHTTP request

  • June 26, 2006
  • 4 replies
  • 886 views
i have a chunk of code that loops over a CFHTTP request to download files off a server. I do not get all the files I am supposed to, and I'm guessing it's because the loop runs too fast. if i run the code one at a time, i get what i expect. is there anyway to slow down the loop or to fix my problem?
<CFLOOP...>
<CFHTTP....
</CFLOOP>
    This topic has been closed for replies.

    4 replies

    June 27, 2006
    Output from running Mr Black's code fragment:
    {ts '2006-06-27 11:42:53'}
    {ts '2006-06-27 11:42:58'}
    {ts '2006-06-27 11:43:03'}
    {ts '2006-06-27 11:43:08'}
    {ts '2006-06-27 11:43:13'}
    BKBK
    Community Expert
    Community Expert
    June 28, 2006
    Your comment, as usual, totally out of topic. The code provided shows an approach to slowdown the sequence of CFHTTP requests, by imposing timeouts between them, sInce this was identified as the initial problem/question. Has nothing to do with your "smart" comments and suggestions. If this works, the scope attribute can be replaced with an arbitrary name.
    Mr Black, it is unwise, very unwise, to apply a server-scoped lock the way you do.

    Definitely, not session-dependent. Guess why?
    Why not? In other words, why may I not store the name of a query in the session scope?

    If you wish to argue, then argue on those technical points. You're quite capable of that. The forum will benefit more from it than from you slinging cheap adjectives about.










    Participating Frequently
    June 27, 2006
    Your comment, as usual, totally out of topic. The code provided shows an approach to slowdown the sequence of CFHTTP requests, by imposing timeouts between them, sInce this was identified as the initial problem/question. Has nothing to do with your "smart" comments and suggestions. If this works, the scope attribute can be replaced with an arbitrary name. Definitely, not session-dependent. Guess why?
    BKBK
    Community Expert
    Community Expert
    June 27, 2006
    <cflock scope="server">
    Unwise. The cfhttp tag requires no compulsory server-scoped variable, let alone one that is updated. There's therefore no motivation for locking the server scope.

    If you insist on locking cfhttp, one way could be to use the the tag's name-attribute. Thus, you use the session-scoped lock, together with <cfhttp name="session.#dynamicallyGeneratedName#">

    June 26, 2006
    You could put CFLOCKS around the CFHTTP, and make the timeout some workable number of seconds - like maybe 8 - 10. Let the lock time out, and catch the error in a CFCATCH block. This way, you are not burning up CPU time doing a CFLOOP from 1 to 100000 to kill time.
    BKBK
    Community Expert
    Community Expert
    June 27, 2006
    I would simply increase cfhttp's timeout value. (Adjust the request timeout setting in the Coldfusion Administrator accordingly).


    brasethAuthor
    Inspiring
    June 27, 2006
    Thanks for the suggestions...however, neither fixed the problem.