gotosocial/vendor/codeberg.org/gruf/go-debug
kim acc95923da
[performance] processing media and scheduled jobs improvements (#1482)
* replace media workers with just runners.WorkerPool, move to state structure, use go-sched for global task scheduling

* improved code comment

* fix worker tryUntil function, update go-runners/go-sched

* make preprocess functions package public, use these where possible to stop doubled up processing

* remove separate emoji worker pool

* limit calls to time.Now() during media preprocessing

* use Processor{} to manage singular runtime of processing media

* ensure workers get started when media manager is used

* improved error setting in processing media, fix media test

* port changes from processingmedia to processing emoji

* finish code commenting

* finish code commenting and comment-out client API + federator worker pools until concurrency worker pools replaced

* linterrrrrrrrrrrrrrrr

---------

Signed-off-by: kim <grufwub@gmail.com>
2023-02-13 18:40:48 +00:00
..
debug.go [performance] processing media and scheduled jobs improvements (#1482) 2023-02-13 18:40:48 +00:00
debug_env.go [performance] processing media and scheduled jobs improvements (#1482) 2023-02-13 18:40:48 +00:00
debug_off.go [performance] processing media and scheduled jobs improvements (#1482) 2023-02-13 18:40:48 +00:00
debug_on.go [performance] processing media and scheduled jobs improvements (#1482) 2023-02-13 18:40:48 +00:00
LICENSE Add support for running profiling when debug build-tags provided (#491) 2022-04-28 13:32:53 +01:00
pprof_off.go Add support for running profiling when debug build-tags provided (#491) 2022-04-28 13:32:53 +01:00
pprof_on.go [performance] processing media and scheduled jobs improvements (#1482) 2023-02-13 18:40:48 +00:00
README.md Add support for running profiling when debug build-tags provided (#491) 2022-04-28 13:32:53 +01:00
run_tests.sh Add support for running profiling when debug build-tags provided (#491) 2022-04-28 13:32:53 +01:00

go-debug

This library provides a very simple method for compile-time or runtime determined debug checks, set using build tags.

The compile-time checks use Go constants, so when disabled your debug code will not be compiled.

The possible build tags are:

  • "debug" || "" = debug determined at compile-time

  • "debugenv" = debug determined at runtime using the $DEBUG environment variable

An example for how this works in practice can be seen by the following code:

func main() {
	println("debug.DEBUG() =", debug.DEBUG())
}
# Debug determined at compile-time, it is disabled
$ go run .
debug.DEBUG() = false

# Debug determined at compile-time, it is enabled
$ go run -tags=debug .
debug.DEBUG() = true

# Debug determined at runtime, $DEBUG is not set
$ go run -tags=debugenv .
debug.DEBUG() = false

# Debug determined at runtime, $DEBUG is set
$ DEBUG=y go run -tags=debugenv .
debug.DEBUG() = true