Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gurinderu committed Apr 2, 2024
1 parent 9f07b1f commit ee52289
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions particle-services/src/app_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use fluence_app_service::{
};
use futures::{StreamExt};
use humantime_serde::re::humantime::format_duration as pretty;
use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard};
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value as JValue};
use tokio::runtime::Handle;
Expand Down Expand Up @@ -86,7 +86,7 @@ pub struct ServiceInfo {
#[derivative(Debug)]
pub struct Service {
#[derivative(Debug(format_with = "fmt_service"))]
pub service: Mutex<AppService>,
pub service: tokio::sync::Mutex<AppService>,
pub service_id: String,
pub blueprint_id: String,
pub service_type: ServiceType,
Expand All @@ -97,7 +97,7 @@ pub struct Service {

impl Service {
pub fn new(
service: Mutex<AppService>,
service: tokio::sync::Mutex<AppService>,
service_id: String,
blueprint_id: String,
service_type: ServiceType,
Expand Down Expand Up @@ -140,15 +140,15 @@ impl Service {
}

impl Deref for Service {
type Target = Mutex<AppService>;
type Target = tokio::sync::Mutex<AppService>;

fn deref(&self) -> &Self::Target {
&self.service
}
}

fn fmt_service(
_: &Mutex<AppService>,
_: &tokio::sync::Mutex<AppService>,
f: &mut std::fmt::Formatter<'_>,
) -> Result<(), std::fmt::Error> {
f.debug_struct("Mutex<AppService>").finish()
Expand Down Expand Up @@ -491,7 +491,7 @@ impl ParticleAppServices {
let function_name = function_args.function_name;

let lock_acquire_start = Instant::now();
let mut service = service.lock();
let mut service = service.lock().await;
let old_memory = service.module_memory_stats();
let old_mem_usage = ServicesMetricsBuiltin::get_used_memory(&old_memory);
// TODO async-marine: set execution timeout https://github.com/fluencelabs/fluence/issues/1212
Expand Down Expand Up @@ -859,7 +859,7 @@ impl ParticleAppServices {
.get_service(peer_scope, service_id, particle_id)
.await?;

let lock = service.service.lock();
let lock = service.service.lock().await;
let stats = lock.module_memory_stats();
let stats = stats
.modules
Expand Down Expand Up @@ -1001,7 +1001,7 @@ impl ParticleAppServices {
let stats = ServiceMemoryStat::new(&stats);

let service = Service::new(
Mutex::new(service),
tokio::sync::Mutex::new(service),
service_id.clone(),
blueprint_id,
service_type,
Expand Down

0 comments on commit ee52289

Please sign in to comment.