Skip to content

Commit

Permalink
correct serialization of cpu period, and better description (#468)
Browse files Browse the repository at this point in the history
The cpu period was incorrectly being serialized as seconds, instead of
microseconds, this corrects that, and also clarifies that the total
cpu time ulimit is serialized as seconds
  • Loading branch information
pretentious7 committed Oct 25, 2023
1 parent d7cba5a commit 1e57a27
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/src/messages/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use plane_core_nats_macros::{self, TypedMessage};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use serde_with::serde_as;
use serde_with::DurationSeconds;
use serde_with::{DurationMicroSeconds, DurationSeconds};
use std::{
collections::HashMap,
fmt::{self, Display, Formatter},
Expand Down Expand Up @@ -363,13 +363,13 @@ pub struct SpawnRequest {
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
pub struct ResourceLimits {
/// Period of cpu time, serializes as microseconds
#[serde_as(as = "Option<DurationSeconds>")]
#[serde_as(as = "Option<DurationMicroSeconds>")]
pub cpu_period: Option<Duration>,

/// Proportion of period used by container
pub cpu_period_percent: Option<u8>,

/// Total cpu time allocated to container
/// Total cpu time allocated to container, serializes as seconds
#[serde_as(as = "Option<DurationSeconds>")]
pub cpu_time_limit: Option<Duration>,

Expand Down

0 comments on commit 1e57a27

Please sign in to comment.