Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LastUpdate to also keep track of the creation date #321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use LastUpdate to also keep track of the creation date
This would allow a cleanup process to remove forgotten / unused accounts based on LastUpdate field
babs committed Nov 2, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7d0d2dd4dc07f0aa31864087e9a45377f7cbc7f3
4 changes: 3 additions & 1 deletion db.go
Original file line number Diff line number Diff line change
@@ -164,7 +164,9 @@ func (d *acmedb) handleDBUpgradeTo1() error {
// Create two rows for subdomain to the txt table
func (d *acmedb) NewTXTValuesInTransaction(tx *sql.Tx, subdomain string) error {
var err error
instr := fmt.Sprintf("INSERT INTO txt (Subdomain, LastUpdate) values('%s', 0)", subdomain)
// Set initial LastUpdate to (now-1) to avoid race condition during test while preserving a hint of the creation date
initialLastUpdate := time.Now().Unix() - 1
instr := fmt.Sprintf("INSERT INTO txt (Subdomain, LastUpdate) values('%s', %d)", subdomain, initialLastUpdate)
_, _ = tx.Exec(instr)
_, _ = tx.Exec(instr)
return err