mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-15 00:19:29 +01:00
Merge pull request #1970 from ergochat/devel+issue1969_alignment
fix #1969
This commit is contained in:
commit
c0e7aac862
@ -45,7 +45,7 @@ const (
|
|||||||
type e struct{}
|
type e struct{}
|
||||||
|
|
||||||
type MySQL struct {
|
type MySQL struct {
|
||||||
timeout int64
|
timeout *int64
|
||||||
trackAccountMessages uint32
|
trackAccountMessages uint32
|
||||||
db *sql.DB
|
db *sql.DB
|
||||||
logger *logger.Manager
|
logger *logger.Manager
|
||||||
@ -63,13 +63,14 @@ type MySQL struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mysql *MySQL) Initialize(logger *logger.Manager, config Config) {
|
func (mysql *MySQL) Initialize(logger *logger.Manager, config Config) {
|
||||||
|
mysql.timeout = new(int64)
|
||||||
mysql.logger = logger
|
mysql.logger = logger
|
||||||
mysql.wakeForgetter = make(chan e, 1)
|
mysql.wakeForgetter = make(chan e, 1)
|
||||||
mysql.SetConfig(config)
|
mysql.SetConfig(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mysql *MySQL) SetConfig(config Config) {
|
func (mysql *MySQL) SetConfig(config Config) {
|
||||||
atomic.StoreInt64(&mysql.timeout, int64(config.Timeout))
|
atomic.StoreInt64(mysql.timeout, int64(config.Timeout))
|
||||||
var trackAccountMessages uint32
|
var trackAccountMessages uint32
|
||||||
if config.TrackAccountMessages {
|
if config.TrackAccountMessages {
|
||||||
trackAccountMessages = 1
|
trackAccountMessages = 1
|
||||||
@ -554,7 +555,7 @@ func (mysql *MySQL) prepareStatements() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mysql *MySQL) getTimeout() time.Duration {
|
func (mysql *MySQL) getTimeout() time.Duration {
|
||||||
return time.Duration(atomic.LoadInt64(&mysql.timeout))
|
return time.Duration(atomic.LoadInt64(mysql.timeout))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mysql *MySQL) isTrackingAccountMessages() bool {
|
func (mysql *MySQL) isTrackingAccountMessages() bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user