dmarcuse / turbokrist

The first-ever GPU accelerated Krist miner - using Java and OpenCL.
GNU General Public License v3.0
6 stars 3 forks source link

turbokrist stops mining after encountering a 429 Too Many Requests error. #20

Open CompaqDisc opened 7 years ago

CompaqDisc commented 7 years ago

Description

Turbokrist stops mining if it has submitted too many rejected solutions too quickly, encountering an HTTP 429: Too Many Requests

Expected Behavior

After encountering the HTTP error, Turbokrist should have either waited for the Retry-After response header's duration and keep mining or fully crash so that a script may restart it.

Steps to reproduce

  1. Let Turbokrist run for a while
  2. Turbokrist starts submitting many rejected solutions
  3. krist.ceriat.net returns an HTTP 429: Too Many Requests
  4. Turbokrist encounters an error, and stops mining without fully crashing

Other Information

Ubuntu 16.04.2 64-bit, GeForce GTX 950M: Driver 378.13

I discovered that krist.ceriat.net returns a pair of headers, X-Ratelimit-Remaining and X-Ratelimit-Limit, that can be used to check rates and halt requests in a timeout period. Rates seem to be per minute.

Error Report / Screenshot / Other Media

turbokrist.2017-04-01.00:02:51.snip.log

CompaqDisc commented 7 years ago

An extra look at the headers.

HTTP/1.1 429 Too Many Requests
Content-Type: text/html; charset=utf-8
Date: Sat, 01 Apr 2017 14:40:37 GMT
Server: Caddy
Vary: Accept
X-Ratelimit-Limit: 320
X-Ratelimit-Remaining: 0

And the normal ones.

HTTP/1.1 200 OK
Access-Control-Allow-Methods: GET, POST, PUT, UPDATE, DELETE, OPTIONS
Access-Control-Allow-Origin: *
Content-Length: 5911
Content-Type: text/html; charset=utf-8
Date: Sat, 01 Apr 2017 14:39:31 GMT
Server: Caddy
X-Ratelimit-Limit: 320
X-Ratelimit-Remaining: 67
X-Robots-Tag: none
Lemmmy commented 7 years ago

the limit is 320 requests in a 60 second window. after 240 requests in the window, your delays are delayed by 5n ms where n is the request number - 240