Remove Timezone Dependency
Formerly, the initial record pull was based on the current time of the server minus five minutes. This caused timing issues, specifically in the case where the database server and dbmonitor server had different timezones set. The initial record is now grabbed based on the timestamp of the last record insertted into the table. If there are no records in the database 0000-01-01 00:00:00 is used as the initial timestamp.
This commit is contained in:
parent
f5b4a55071
commit
f4ebe7536f
1 changed files with 4 additions and 1 deletions
|
@ -10,7 +10,10 @@ db = require('mysql-native').createTCPClient(database.host, database.port)
|
|||
db.auth database.database, database.username, database.password
|
||||
db.auto_prepare = true
|
||||
|
||||
checkDate = moment().add('minutes', -5)
|
||||
checkDate = moment('0000-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss')
|
||||
query = "SELECT " + application.timestamp_column + " FROM `print_jobs` ORDER BY " + application.timestamp_column + " DESC LIMIT 1"
|
||||
db.query(query).addListener 'row', (start) ->
|
||||
checkDate = moment(start[application.timestamp_column], 'YYYY-MM-DD HH:mm:ss')
|
||||
|
||||
getDatabaseUpdates = () ->
|
||||
query = "SELECT " + application.timestamp_column + "," + application.columns.join(',') + " FROM " + application.table + " WHERE " + application.where + " AND " + application.timestamp_column + " > '" + checkDate.format('YYYY-MM-DD HH:mm:ss') + "'"
|
||||
|
|
Loading…
Reference in a new issue