Skip to content

Commit

Permalink
use CURRENT_TIMESTAMP instead of NOW()
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Aug 16, 2010
1 parent 86e59fe commit 3d3e060
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bley.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def check_policy (self):
else:
new_status = 0
self.factory.good_cache[postfix_params['client_address']] = datetime.datetime.now()
query = "INSERT INTO bley_status (ip, status, last_action, sender, recipient) VALUES(%(client_address)s, %(new_status)s, NOW(), %(sender)s, %(recipient)s)"
query = "INSERT INTO bley_status (ip, status, last_action, sender, recipient) VALUES(%(client_address)s, %(new_status)s, CURRENT_TIMESTAMP, %(sender)s, %(recipient)s)"
postfix_params['new_status'] = new_status
try:
self.safe_execute(query, postfix_params)
Expand All @@ -154,7 +154,7 @@ def check_policy (self):
delta = datetime.datetime.now()-status[1]
if delta > self.factory.settings.greylist_period+status[2]*self.factory.settings.greylist_penalty or delta > self.factory.settings.greylist_max:
action = 'DUNNO'
query = "UPDATE bley_status SET status=0, last_action=NOW() WHERE ip=%(client_address)s AND sender=%(sender)s AND recipient=%(recipient)s"
query = "UPDATE bley_status SET status=0, last_action=CURRENT_TIMESTAMP WHERE ip=%(client_address)s AND sender=%(sender)s AND recipient=%(recipient)s"
self.factory.good_cache[postfix_params['client_address']] = datetime.datetime.now()
else:
action = 'DEFER_IF_PERMIT %s' % self.factory.settings.reject_msg
Expand All @@ -166,7 +166,7 @@ def check_policy (self):
else: # found to be clean
check_results['DB'] = status[0]
action = 'DUNNO'
query = "UPDATE bley_status SET last_action=NOW() WHERE ip=%(client_address)s AND sender=%(sender)s AND recipient=%(recipient)s"
query = "UPDATE bley_status SET last_action=CURRENT_TIMESTAMP WHERE ip=%(client_address)s AND sender=%(sender)s AND recipient=%(recipient)s"
self.safe_execute(query, postfix_params)
self.db.commit()
self.factory.good_cache[postfix_params['client_address']] = datetime.datetime.now()
Expand Down

0 comments on commit 3d3e060

Please sign in to comment.