refactor: rename write_validated_key_to_tier_files to write_validated_key_to_tier_writers for consistency
parent
3ca85a4749
commit
f126073ce7
|
@ -2,4 +2,4 @@ pub mod input;
|
|||
pub mod output;
|
||||
|
||||
pub use input::load_keys_from_txt;
|
||||
pub use output::write_validated_key_to_tier_files;
|
||||
pub use output::write_validated_key_to_tier_writers;
|
||||
|
|
|
@ -6,9 +6,9 @@ use toml::Value;
|
|||
use tracing::info;
|
||||
|
||||
// Write valid key to appropriate tier file
|
||||
pub async fn write_validated_key_to_tier_files<W>(
|
||||
free_file: &mut W,
|
||||
paid_file: &mut W,
|
||||
pub async fn write_validated_key_to_tier_writers<W>(
|
||||
free_writer: &mut W,
|
||||
paid_writer: &mut W,
|
||||
validated_key: &ValidatedKey,
|
||||
) -> Result<(), ValidatorError>
|
||||
where
|
||||
|
@ -16,12 +16,12 @@ where
|
|||
{
|
||||
match validated_key.tier {
|
||||
KeyTier::Free => {
|
||||
free_file
|
||||
free_writer
|
||||
.write_all(format!("{}\n", validated_key.key.as_ref()).as_bytes())
|
||||
.await?;
|
||||
}
|
||||
KeyTier::Paid => {
|
||||
paid_file
|
||||
paid_writer
|
||||
.write_all(format!("{}\n", validated_key.key.as_ref()).as_bytes())
|
||||
.await?;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use super::key_validator::{test_cache_content_api, test_generate_content_api};
|
||||
use crate::adapters::{load_keys_from_txt, write_validated_key_to_tier_files};
|
||||
use crate::adapters::{load_keys_from_txt, write_validated_key_to_tier_writers};
|
||||
use crate::config::KeyCheckerConfig;
|
||||
use crate::error::ValidatorError;
|
||||
use crate::types::GeminiKey;
|
||||
|
@ -93,7 +93,7 @@ impl ValidationService {
|
|||
|
||||
// Process validated keys and write to appropriate tier files
|
||||
while let Some(valid_key) = valid_keys_stream.next().await {
|
||||
if let Err(e) = write_validated_key_to_tier_files(
|
||||
if let Err(e) = write_validated_key_to_tier_writers(
|
||||
&mut free_buffer_writer,
|
||||
&mut paid_buffer_writer,
|
||||
&valid_key,
|
||||
|
|
Loading…
Reference in New Issue