gitea/modules/graceful
zeripath daa5a23548
Set self-adjusting deadline for connection writing (#16068)
* Set self-adjusting deadline for connection writing

In #16055 it appears that the simple 5s deadline doesn't work for large
file writes. Now we can't - or at least shouldn't just set no deadline
as go will happily let these connections block indefinitely. However,
what seems reasonable is to set some minimum rate we expect for writing.

This PR suggests the following algorithm:

* Every write has a minimum timeout of 5s (adjustable at compile time.)
* If there has been a previous write - then consider its previous
deadline, add half of the minimum timeout + 2s per kb about to written.
* If that new deadline is after the minimum timeout use that.

Fix #16055

* Linearly increase timeout

* Make PerWriteTimeout, PerWritePerKbTimeouts configurable

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: 6543 <6543@obermui.de>
2021-06-11 00:25:25 +03:00
..
context.go Multiple Queue improvements: LevelDB Wait on empty, shutdown empty shadow level queue, reduce goroutines etc (#15693) 2021-05-15 16:22:26 +02:00
manager_unix.go Multiple Queue improvements: LevelDB Wait on empty, shutdown empty shadow level queue, reduce goroutines etc (#15693) 2021-05-15 16:22:26 +02:00
manager_windows.go Multiple Queue improvements: LevelDB Wait on empty, shutdown empty shadow level queue, reduce goroutines etc (#15693) 2021-05-15 16:22:26 +02:00
manager.go Multiple Queue improvements: LevelDB Wait on empty, shutdown empty shadow level queue, reduce goroutines etc (#15693) 2021-05-15 16:22:26 +02:00
net_unix.go Re-attempt to delete temporary upload if the file is locked by another process (#12447) 2020-08-11 21:05:34 +01:00
net_windows.go Fix missed change to GetManager() (#9361) 2019-12-15 13:15:17 +00:00
restart_unix.go Graceful: Xorm, RepoIndexer, Cron and Others (#9282) 2019-12-15 09:51:28 +00:00
server_hooks.go Graceful: Xorm, RepoIndexer, Cron and Others (#9282) 2019-12-15 09:51:28 +00:00
server_http.go Make modules/context.Context a context.Context (#16031) 2021-05-31 02:18:11 -04:00
server.go Set self-adjusting deadline for connection writing (#16068) 2021-06-11 00:25:25 +03:00