Replace panics with our logging framework
This commit is contained in:
parent
cd15661f08
commit
3f4176d8d6
@ -12,13 +12,13 @@ import (
|
||||
func setSystemConcurrentConnectionLimit(limit int64) {
|
||||
var rLimit syscall.Rlimit
|
||||
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
|
||||
panic(err)
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
originalLimit := rLimit.Cur
|
||||
rLimit.Cur = uint64(limit)
|
||||
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
|
||||
panic(err)
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
log.Traceln("Max process connection count changed from system limit of", originalLimit, "to", limit)
|
||||
|
@ -11,13 +11,13 @@ import (
|
||||
func setSystemConcurrentConnectionLimit(limit int64) {
|
||||
var rLimit syscall.Rlimit
|
||||
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
|
||||
panic(err)
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
originalLimit := rLimit.Cur
|
||||
rLimit.Cur = int64(limit)
|
||||
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
|
||||
panic(err)
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
log.Traceln("Max process connection count changed from system limit of", originalLimit, "to", limit)
|
||||
|
@ -1,11 +1,14 @@
|
||||
package chat
|
||||
|
||||
import "syscall"
|
||||
import (
|
||||
"syscall"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func getMaximumConcurrentConnectionLimit() int64 {
|
||||
var rLimit syscall.Rlimit
|
||||
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
|
||||
panic(err)
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Return the limit to 70% of max so the machine doesn't die even if it's maxed out for some reason.
|
||||
|
@ -122,7 +122,7 @@ func migrateDatabase(db *sql.DB, from, to int) error {
|
||||
log.Tracef("Migration step from %d to %d\n", v, v+1)
|
||||
migrateToSchema1(db)
|
||||
default:
|
||||
panic("missing database migration step")
|
||||
log.Fatalln("missing database migration step")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ func (s *S3Storage) connectAWS() *session.Session {
|
||||
func (s *S3Storage) rewriteRemotePlaylist(filePath string) error {
|
||||
f, err := os.Open(filePath) // nolint
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
p := m3u8.NewMasterPlaylist()
|
||||
|
@ -105,7 +105,7 @@ func (t *Transcoder) Start() {
|
||||
|
||||
stdout, err := _commandExec.StderrPipe()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
if err := _commandExec.Start(); err != nil {
|
||||
|
@ -132,7 +132,7 @@ func RenderSimpleMarkdown(raw string) string {
|
||||
trimmed := strings.TrimSpace(raw)
|
||||
var buf bytes.Buffer
|
||||
if err := markdown.Convert([]byte(trimmed), &buf); err != nil {
|
||||
panic(err)
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
@ -161,7 +161,7 @@ func RenderPageContentMarkdown(raw string) string {
|
||||
trimmed := strings.TrimSpace(raw)
|
||||
var buf bytes.Buffer
|
||||
if err := markdown.Convert([]byte(trimmed), &buf); err != nil {
|
||||
panic(err)
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
return strings.TrimSpace(buf.String())
|
||||
|
Loading…
x
Reference in New Issue
Block a user