chore: clean code
This commit is contained in:
@@ -18,8 +18,8 @@ pub struct InnerTextMessage {
|
||||
}
|
||||
|
||||
pub fn send_dingtalk_message(cert_config: &CertConfig, message: &str) -> XResult<()> {
|
||||
let dintalk_notify_token = get_dingtalk_notify_token(cert_config);
|
||||
if let Some((access_token, sec_token)) = &dintalk_notify_token {
|
||||
let dingtalk_notify_token = get_dingtalk_notify_token(cert_config);
|
||||
if let Some((access_token, sec_token)) = &dingtalk_notify_token {
|
||||
inner_send_dingtalk_message(access_token, sec_token, message)?;
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use std::thread;
|
||||
use std::thread::JoinHandle;
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
use std::thread::{JoinHandle, spawn, sleep};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
use std::time::Duration;
|
||||
use rust_util::XResult;
|
||||
|
||||
@@ -28,7 +27,7 @@ impl SimpleThreadPool {
|
||||
let running = self.running_pool_size.fetch_add(1, Ordering::SeqCst);
|
||||
let running_pool_size_clone = self.running_pool_size.clone();
|
||||
if running < self.max_pool_size {
|
||||
Some(thread::spawn(move || {
|
||||
Some(spawn(move || {
|
||||
f();
|
||||
running_pool_size_clone.fetch_sub(1, Ordering::SeqCst);
|
||||
}))
|
||||
@@ -47,7 +46,7 @@ fn test_simple_thread_pool() {
|
||||
for i in 1..10 {
|
||||
if let Some(h) = stp.submit(move || {
|
||||
println!("Task start: {}", i);
|
||||
thread::sleep(Duration::from_secs(1));
|
||||
sleep(Duration::from_secs(1));
|
||||
println!("Task end: {}", i);
|
||||
}) {
|
||||
handlers.push(h);
|
||||
|
||||
Reference in New Issue
Block a user