Skip to content

Commit 678113e

Browse files
committed
agent: restart webserver after token update
Restart the webserver when key material database in the S3 bucket is updated, ensuring that the webserver always uses the latest token and key material. Signed-off-by: Erdem Meydanli <[email protected]>
1 parent 8c7ff8d commit 678113e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/vtok_agent/src/agent/mngtok.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl ManagedToken {
304304
})
305305
}
306306

307-
fn update(&mut self) -> Result<(), Error> {
307+
fn update(&mut self) -> Result<Option<PostSyncAction>, Error> {
308308
self.enclave
309309
.update_token(
310310
self.label.clone(),
@@ -315,18 +315,18 @@ impl ManagedToken {
315315
.map_err(Error::UpdateTokenError)?;
316316

317317
if let Some(_target) = self.target.as_ref() {
318-
debug!("Updating managed service configuration");
319-
self.satisfy_target(false).or_else(|e| {
318+
debug!("Updating managed service configuration.");
319+
return self.satisfy_target(true).or_else(|e| {
320320
error!(
321321
"Failed to update managed service configuration for token {}: {:?}",
322322
self.label.as_str(),
323323
e
324324
);
325325
Ok(None)
326-
})?;
326+
});
327327
}
328328

329-
Ok(())
329+
Ok(None)
330330
}
331331

332332
fn refresh(&mut self) -> Result<(), Error> {
@@ -371,7 +371,7 @@ impl ManagedToken {
371371
match (is_online, db_changed) {
372372
(true, true) => {
373373
info!("DB change detected. Updating token: {}.", self.label.as_str());
374-
self.update()?;
374+
return self.update();
375375
}
376376
(true, false) => {
377377
if self.next_refresh <= Instant::now() {

0 commit comments

Comments
 (0)