3
0
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:
Shivaram Lingamneni 2022-06-10 07:53:04 -07:00 committed by GitHub
commit c0e7aac862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ const (
type e struct{}
type MySQL struct {
timeout int64
timeout *int64
trackAccountMessages uint32
db *sql.DB
logger *logger.Manager
@ -63,13 +63,14 @@ type MySQL struct {
}
func (mysql *MySQL) Initialize(logger *logger.Manager, config Config) {
mysql.timeout = new(int64)
mysql.logger = logger
mysql.wakeForgetter = make(chan e, 1)
mysql.SetConfig(config)
}
func (mysql *MySQL) SetConfig(config Config) {
atomic.StoreInt64(&mysql.timeout, int64(config.Timeout))
atomic.StoreInt64(mysql.timeout, int64(config.Timeout))
var trackAccountMessages uint32
if config.TrackAccountMessages {
trackAccountMessages = 1
@ -554,7 +555,7 @@ func (mysql *MySQL) prepareStatements() (err error) {
}
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 {