From bbf801f35bd8d5ac23bf3117085fa7044e9c31c9 Mon Sep 17 00:00:00 2001 From: sc0vu Date: Tue, 8 Aug 2023 15:50:53 +0800 Subject: [PATCH] server: update for expiration --- server/internal/pki/pki.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/server/internal/pki/pki.go b/server/internal/pki/pki.go index 31f6ff8..c703f37 100644 --- a/server/internal/pki/pki.go +++ b/server/internal/pki/pki.go @@ -352,12 +352,10 @@ func (p *pki) publishDescriptorIfNeeded(pkiCtx context.Context) error { } if till < publishGracePeriod { // check whether the certificate is expired and the network stuck - if p.lastPublishedEpoch > 0 { - if epoch > 0 && (epoch-p.lastPublishedEpoch) > s11n.CertificateExpiration { - // Should we republish epoch + 1? - p.log.Debugf("Publish epoch again: %d.", epoch) - p.lastPublishedEpoch = 0 - } + if p.lastPublishedEpoch > 0 && (epoch > 0 && (epoch-p.lastPublishedEpoch) > s11n.CertificateExpiration) { + // Should we republish epoch + 1? + p.log.Debugf("Publish epoch again: %d.", epoch) + p.lastPublishedEpoch = 0 } else { epoch++ }