diff options
author | JeffB42 <10328858+JeffB42@users.noreply.github.com> | 2021-03-28 20:49:49 +0300 |
---|---|---|
committer | JeffB42 <10328858+JeffB42@users.noreply.github.com> | 2021-03-28 20:49:49 +0300 |
commit | 10465926aee181622f43ec58f8bbe6192f50d438 (patch) | |
tree | 069c8328ed41deb84ff494103f0941d49471e715 | |
parent | 1184d67315f2f967aa3c4b75f109efffedad9361 (diff) |
added a pause of 5 seconds in OctoScreenSettingsRequest.Do() to prevent plug-in loading bug
-rwxr-xr-x | octoprintApis/OctoScreenSettingsRequest.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/octoprintApis/OctoScreenSettingsRequest.go b/octoprintApis/OctoScreenSettingsRequest.go index 0ca8974..fb12473 100755 --- a/octoprintApis/OctoScreenSettingsRequest.go +++ b/octoprintApis/OctoScreenSettingsRequest.go @@ -3,6 +3,7 @@ package octoprintApis import ( "encoding/json" "fmt" + "time" "github.com/Z-Bolt/OctoScreen/octoprintApis/dataModels" ) @@ -16,6 +17,12 @@ type OctoScreenSettingsRequest struct { } func (this *OctoScreenSettingsRequest) Do(client *Client, uiState string) (*dataModels.OctoScreenSettingsResponse, error) { + // Pause for 5 seconds here. This is in response to the "OctoScreen 2.7.0 doesn't recognize that OctoScreen plugin 2.6.0 is installed" + // bug (see https://github.com/Z-Bolt/OctoScreen/issues/275). I was able to repro the bug sometimes, yet other times it worked fine. + // I examined the logs and they were exactly the same (up to the error, which was "HTTP/1.x transport connection broken: malformed MIME + // header line: Not found"). Very weird. + time.Sleep(time.Second * 5) + target := fmt.Sprintf("%s?command=get_settings", PluginZBoltOctoScreenApiUri) bytes, err := client.doJsonRequest("GET", target, nil, ConnectionErrors) if err != nil { |