The Inbox: HelpSystem-Core-ct.131.mcz

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

The Inbox: HelpSystem-Core-ct.131.mcz

commits-2
Christoph Thiede uploaded a new version of HelpSystem-Core to project The Inbox:
http://source.squeak.org/inbox/HelpSystem-Core-ct.131.mcz

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

Name: HelpSystem-Core-ct.131
Author: ct
Time: 2 March 2020, 10:56:11.800949 am
UUID: 9b0d6d0c-a344-5648-9a03-7ac23afa7515
Ancestors: HelpSystem-Core-mt.119

Proposal: Make HtmlHelpTopic downloads more robust by retrying the download up to three times if the request was not successful.

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

Item was changed:
  ----- Method: HtmlHelpTopic>>document (in category 'accessing') -----
  document
 
+ | retriesRemaining |
+ document ifNotNil: [^ document].
+ retriesRemaining := 3.
+ ^ document := [
- ^ document ifNil: [document :=
  [
+ | response |
+ response := WebClient new httpGet: self url do: [:req |
+ req headerAt: 'Accept' put: 'text/html'].
+ response isSuccess
+ ifFalse: [self error: #serverError].
+ response content
+ ] on: Error do: [:err |
+ err messageText = #serverError
+ ifFalse: [err pass].
+ retriesRemaining strictlyPositive
+ ifFalse: [err ignore]
+ ifTrue: [
+ retriesRemaining := retriesRemaining - 1.
+ err retry]]
+ ] on: Error do: [:err | err printString]!
- (HTTPSocket httpGet: self url accept: 'text/html') contents
- ] on: Error do: [:err | err printString]]!