The Inbox: HelpSystem-Core-kks.120.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: HelpSystem-Core-kks.120.mcz

commits-2
A new version of HelpSystem-Core was added to project The Inbox:
http://source.squeak.org/inbox/HelpSystem-Core-kks.120.mcz

==================== Summary ====================

Name: HelpSystem-Core-kks.120
Author: kks
Time: 2 April 2020, 8:45:13.607196 pm
UUID: 33119c75-ba40-45d4-8ede-7086b7f4bc60
Ancestors: HelpSystem-Core-mt.119

Fetch a topic document afresh from the server if the previous fetch resulted in an 500 error.

=============== Diff against HelpSystem-Core-mt.119 ===============

Item was changed:
  ----- Method: HtmlHelpTopic>>document (in category 'accessing') -----
  document
 
+ (document isNil or: [document includesSubstring: '<title>500 Internal']) ifTrue: [
+ document := [
+ (HTTPSocket httpGet: self url accept: 'text/html') contents
+ ] on: Error do: [:err | err printString]].
+ ^document!
- ^ document ifNil: [document :=
- [
- (HTTPSocket httpGet: self url accept: 'text/html') contents
- ] on: Error do: [:err | err printString]]!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: HelpSystem-Core-kks.120.mcz

K K Subbu
Hi,

I have an alternate proposal to recover from 500 error on HTML help
topics. Instead of retrying 3 times [1], we just back off and retry only
when the document is needed next. If the server is busy then backing off
may be better than retries.

If a 'refresh' menu is available to force an update, then this changeset
is not needed.

[1]
http://forum.world.st/The-Inbox-HelpSystem-Core-ct-131-mcz-td5112713.html

Regards .. Subbu

On 02/04/20 3:15 PM, [hidden email] wrote:

> A new version of HelpSystem-Core was added to project The Inbox:
> http://source.squeak.org/inbox/HelpSystem-Core-kks.120.mcz
>
> ==================== Summary ====================
>
> Name: HelpSystem-Core-kks.120
> Author: kks
> Time: 2 April 2020, 8:45:13.607196 pm
> UUID: 33119c75-ba40-45d4-8ede-7086b7f4bc60
> Ancestors: HelpSystem-Core-mt.119
>
> Fetch a topic document afresh from the server if the previous fetch resulted in an 500 error.
>
> =============== Diff against HelpSystem-Core-mt.119 ===============
>
> Item was changed:
>    ----- Method: HtmlHelpTopic>>document (in category 'accessing') -----
>    document
>    
> + (document isNil or: [document includesSubstring: '<title>500 Internal']) ifTrue: [
> + document := [
> + (HTTPSocket httpGet: self url accept: 'text/html') contents
> + ] on: Error do: [:err | err printString]].
> + ^document!
> - ^ document ifNil: [document :=
> - [
> - (HTTPSocket httpGet: self url accept: 'text/html') contents
> - ] on: Error do: [:err | err printString]]!
>
>


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: HelpSystem-Core-kks.120.mcz

marcel.taeumel
Hi Subbu!

+1

Those arbitrary number of retries did never work for me in Metacello either. There should some delay in between. The one you proposed here sounds good. And we have a virtually unlimited number of retries here. :-)

Best,
Marcel

Am 02.04.2020 17:29:55 schrieb K K Subbu <[hidden email]>:

Hi,

I have an alternate proposal to recover from 500 error on HTML help
topics. Instead of retrying 3 times [1], we just back off and retry only
when the document is needed next. If the server is busy then backing off
may be better than retries.

If a 'refresh' menu is available to force an update, then this changeset
is not needed.

[1]
http://forum.world.st/The-Inbox-HelpSystem-Core-ct-131-mcz-td5112713.html

Regards .. Subbu

On 02/04/20 3:15 PM, [hidden email] wrote:
> A new version of HelpSystem-Core was added to project The Inbox:
> http://source.squeak.org/inbox/HelpSystem-Core-kks.120.mcz
>
> ==================== Summary ====================
>
> Name: HelpSystem-Core-kks.120
> Author: kks
> Time: 2 April 2020, 8:45:13.607196 pm
> UUID: 33119c75-ba40-45d4-8ede-7086b7f4bc60
> Ancestors: HelpSystem-Core-mt.119
>
> Fetch a topic document afresh from the server if the previous fetch resulted in an 500 error.
>
> =============== Diff against HelpSystem-Core-mt.119 ===============
>
> Item was changed:
> ----- Method: HtmlHelpTopic>>document (in category 'accessing') -----
> document
>
> + (document isNil or: [document includesSubstring: '500 Internal']) ifTrue: [<br>> + document := [<br>> + (HTTPSocket httpGet: self url accept: 'text/html') contents<br>> + ] on: Error do: [:err | err printString]].<br>> + ^document!<br>> - ^ document ifNil: [document :=<br>> - [<br>> - (HTTPSocket httpGet: self url accept: 'text/html') contents<br>> - ] on: Error do: [:err | err printString]]!<br>> <br>> <br><br><br>


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: HelpSystem-Core-kks.120.mcz

Levente Uzonyi
In reply to this post by commits-2
I think the proper way to do this would be to leave HTTPSocket behind and
rely on the response code instead of checking for a specific substring in
the response body.
Should the server change in any way (either the reverse proxy or the
image), that string may not be there anymore.


Levente

On Thu, 2 Apr 2020, [hidden email] wrote:

> A new version of HelpSystem-Core was added to project The Inbox:
> http://source.squeak.org/inbox/HelpSystem-Core-kks.120.mcz
>
> ==================== Summary ====================
>
> Name: HelpSystem-Core-kks.120
> Author: kks
> Time: 2 April 2020, 8:45:13.607196 pm
> UUID: 33119c75-ba40-45d4-8ede-7086b7f4bc60
> Ancestors: HelpSystem-Core-mt.119
>
> Fetch a topic document afresh from the server if the previous fetch resulted in an 500 error.
>
> =============== Diff against HelpSystem-Core-mt.119 ===============
>
> Item was changed:
>  ----- Method: HtmlHelpTopic>>document (in category 'accessing') -----
>  document
>
> + (document isNil or: [document includesSubstring: '<title>500 Internal']) ifTrue: [
> + document := [
> + (HTTPSocket httpGet: self url accept: 'text/html') contents
> + ] on: Error do: [:err | err printString]].
> + ^document!
> - ^ document ifNil: [document :=
> - [
> - (HTTPSocket httpGet: self url accept: 'text/html') contents
> - ] on: Error do: [:err | err printString]]!

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: HelpSystem-Core-kks.120.mcz

K K Subbu
On 03/04/20 1:24 PM, Levente Uzonyi wrote:
> I think the proper way to do this would be to leave HTTPSocket behind
> and rely on the response code instead of checking for a specific
> substring in the response body.

httpGet does not return a HTTP response object but a string in case of
errors. This is why I put in this check.

Did you mean I could have done something like this:

^ document ifNil: [
     |resp|
     resp := HTTPSocket httpGetDocument: self url accept:'text/html'.
     document := resp isString ifTrue: [nil] ifFalse: [resp contents]]

This would mean retries even for 4xx or 3xx codes :-(

Regards .. Subbu