[plt-scheme] plt web-server: adjust-timeout! ? BIRDBRAIN!
I'm such a birdbrain,
adjust-timeout! has to be in the function given to send/supend of course!
Thanks anyway!
Hans Oesterholt-Dijkema schreef:
> I added some extra debug information.
>
> I changed the example add.ss with an extra adjust-timeout!:
>
> (require (lib "unitsig.ss")
> (lib "servlet-sig.ss" "web-server")
> (lib "date.ss"))
>
> (unit/sig () (import servlet^)
>
> ; request-number : str -> num
> (define (request-number which-number)
> (string->number
> (extract-binding/single
> 'number
> (request-bindings (send/suspend (build-request-page
> which-number))))))
>
> ; build-request-page : str -> str -> response
> (define (build-request-page which-number)
> (lambda (k-url)
> `(html (head (title "Enter a Number to Add"))
> (body ([bgcolor "white"])
> (form ([action ,k-url] [method "post"])
> "Enter the " ,which-number " number to add: "
> (input ([type "text"] [name "number"] [value
> ""]))
> (input ([type "submit"] [name "enter"] [value
> "Enter"])))))))
>
> (adjust-timeout! 30)
>
> `(html (head (title "Sum"))
> (body ([bgcolor "white"])
> (p "The sum is "
> ,(number->string (+ (request-number "first")
> (request-number "second")))))))
>
> Well, this is the logging I get. The adjust-timeout! value is set to
> 30. Next. I see a timer added with id 1.
> This timer with id 1 is updated serveral times (different values?)
>
> Next I see a timer added with id=2 and id=3. These are expired within
> 1 second. The add servlets post action gets
> invalidated and is removed. I'd want to change the value of
> send/suspend. But this seems to be related to the
> 'default-servlet-timeout' value? But what about this 'adjust-timeout!'?
>
> revise-timer: 1:id:#f 1183103685178.0 1183103654178.0 31000
> #<procedure:provide/contract-field-contract-action-timer>
> Add timer: ID=0
> revise-timer: 2:id:0 1183103685178.0 1183103654178.0 31000
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 1:id:0 1183103685178.0 1183103654258.0 86400000
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:0 1183190054258.0 1183103654258.0 86400000
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 1:id:#f 1183190054328.0 1183103654328.0 172800000.0
> #<procedure:provide/contract-field-contract-action-timer>
> 1
> adjust-timeout! 1 30
> revise-timer: 1:id:#f 1183190054328.0 1183103654328.0 172800000.0
> #<procedure:provide/contract-field-contract-action-timer>
> *revise-timer: 1:id:#f 1183190054328.0 1183103654328.0 30000
> #<procedure:provide/contract-field-contract-action-timer>*
> Add timer: ID=1
> revise-timer: 2:id:1 1183276454328.0 1183103654328.0 172800000.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 1:id:1 1183276454328.0 1183103654328.0 259200000.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:1 1183276454328.0 1183103654328.0 172800000.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:1 1183103684328.0 1183103654328.0 30000
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:1 1183362854328.0 1183103654328.0 259200000.0
> #<procedure:provide/contract-field-contract-action-timer>
> Add timer: ID=2
> ALARM!: id:2 1183103655328.0 1183103655329.0
> Add timer: ID=3
> ALARM!: id:3 1183103655329.0 1183103655339.0
> revise-timer: 1:id:0 1183190054258.0 1183103660988.0 31000
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 1:id:0 1183190054258.0 1183103660988.0 86400000
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:0 1183103691988.0 1183103660988.0 31000
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:0 1183190060988.0 1183103660988.0 86400000
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 1:id:1 1183362854328.0 1183103660998.0 345593330.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:1 1183449254328.0 1183103660998.0 345593330.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 1:id:1 1183449254328.0 1183103660998.0 431993330.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 1:id:1 1183449254328.0 1183103660998.0 431993330.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:1 1183535654328.0 1183103660998.0 431993330.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:1 1183535654328.0 1183103660998.0 431993330.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 1:id:3 1183103655329.0 1183103660998.0 -4669.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:3 1183103656329.0 1183103660998.0 -4669.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 1:id:1 1183535654328.0 1183103660998.0 518393330.0
> #<procedure:provide/contract-field-contract-action-timer>
> revise-timer: 2:id:1 1183622054328.0 1183103660998.0 518393330.0
> #<procedure:provide/contract-field-contract-action-timer>
>
>
> Hans Oesterholt-Dijkema schreef:
>> What I actually see, is the initial-connect-timeout value reset my
>> servlet.
>> It times out and resets my servlet.
>>
>> Am I doing something wrong in my servlet code?
>>
>> --Hans
>>
>> (define (hwiki-start request set-timeout)
>>
>> (if INSTALL-PLUGINS
>> (begin
>> (debug "Installing plugins")
>> (let ((f (dynamic-require "hwiki-plugins.scm"
>> 'install-plugins)))
>> (debug (format "dynamic require of
>> 'hwiki-plugins.scm' results in ~a" f))
>> (f)
>> (set! INSTALL-PLUGINS #f))))
>>
>> (debug "START" (url->string (request-uri request)))
>> (let ((context (get-context request)))
>>
>> (set-timeout context)
>>
>> (let ((P (page context)))
>> (let ((function (if (or (-> P special?) (-> context
>> logged-in?))
>> send/suspend
>> send/forward)))
>> (if (not (-> P special?))
>> (-> context from-where (-> context page-name)))
>> (debug "special?" (-> P special?) " function: "
>> function " context:" (-> context context))
>> (let ((R (-> P create-html)))
>> (debug "calling " R)
>> (let ((B (function R)))
>> (debug "RESTART" R function B)
>> (hwiki-start B set-timeout)))))))
>>
>>
>> Hans Oesterholt-Dijkema schreef:
>>> The timeout occurs every 30 seconds. As configured in the
>>> configuration file:
>>>
>>> (default-servlet-timeout 30)
>>>
>>> ?
>>>
>>> I see "revise-timer" gets called after my servlet has been run with
>>> a value
>>> of 30. Also, within a send/suspend situation. My web server config
>>> is set
>>> to 3600 seconds, so I won't notice much over there. But I want to
>>> shorten
>>> the servlet existence to let's say 120 seconds and when doing edit
>>> session
>>> set it to like 3 hours.
>>>
>>> How does it work?
>>>
>>> --Hans
>>>
>>>
>>> Hans Oesterholt-Dijkema schreef:
>>>> How, wait. I get this message:
>>>>
>>>> http://localhost/servlets;4*1*1739593/hwiki.scm/special:edit.html?context=
>>>>
>>>>
>>>> Not Found
>>>>
>>>> Couldn't find what you were looking for. Sorry.
>>>>
>>>> Also when I set the initial value of the timeout to 120 or 1200.
>>>> After about just as much time.
>>>>
>>>> Any ideas?
>>>>
>>>> --Hans
>>>>
>>>>
>>>> Hans Oesterholt-Dijkema schreef:
>>>>> Dear Jay,
>>>>>
>>>>> Thanks for the answer. I've seen the code. adjust-timeout! is called
>>>>> with the timeout value of the servlet just before the servlet is
>>>>> started.
>>>>>
>>>>> However, when I call adjust-timeout! from the servlet itself,
>>>>> somehow,
>>>>> it doesn't work. Suppose I put the value to * 3 3600 (3 hours), I
>>>>> still
>>>>> get an expiration after the initial 120 seconds (or maybe even
>>>>> faster).
>>>>>
>>>>> I'm debugging your 360 code (just getting to revise-timer), but I'm
>>>>> still not seeing why it doesn't work.
>>>>>
>>>>> What could be wrong?
>>>>>
>>>>> --Hans
>>>>>
>>>>>
>>>>> Jay McCarthy schreef:
>>>>>> adjust-timeout! does not change the timeout variable. It
>>>>>> communicates
>>>>>> an update to the internal timeout counter. The timeout variable
>>>>>> should
>>>>>> really have been named 'initial-timeout', but it is too late.
>>>>>>
>>>>>> Jay
>>>>>>
>>>>>> On 6/28/07, Hans Oesterholt-Dijkema <hdnews at gawab.com> wrote:
>>>>>>> Hi there,
>>>>>>>
>>>>>>> I'm trying to use adjust-timeout! to control the timeout
>>>>>>> behaviour of a module type servlet in the mzscheme
>>>>>>> web-server.
>>>>>>>
>>>>>>> However, adjust-timeout! doesn't seem to be working.
>>>>>>> Whatever I use as a value. The value of the timeout variable
>>>>>>> stays the same.
>>>>>>>
>>>>>>> What should I do to make this work?
>>>>>>>
>>>>>>> --hans
>>>>>>>
>>>>>>> _________________________________________________
>>>>>>> For list-related administrative tasks:
>>>>>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>>>>
>>>>>>
>>>>>>
>>>>> _________________________________________________
>>>>> For list-related administrative tasks:
>>>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>>
>>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _________________________________________________
>>>> For list-related administrative tasks:
>>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>
>>> ------------------------------------------------------------------------
>>>
>>> _________________________________________________
>>> For list-related administrative tasks:
>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>
>> ------------------------------------------------------------------------
>>
>> _________________________________________________
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
> ------------------------------------------------------------------------
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070629/0a0d9b0d/attachment.html>