Fix: Remove redundant checks and clarify variable scope

- Remove redundant padded_key None check (NonEmptyString cannot be None)
- Move storage_path definition before try block for clarity
- All padded tracks added to list (original or new)
This commit is contained in:
Igor Loskutov
2026-01-23 16:55:34 -05:00
parent 7dfb37154d
commit d0110f4dd4
2 changed files with 8 additions and 8 deletions

View File

@@ -434,7 +434,6 @@ async def process_paddings(input: PipelineInput, ctx: Context) -> ProcessPadding
for result in results:
pad_result = PadTrackResult(**result[TaskName.PAD_TRACK])
if pad_result.padded_key:
padded_tracks.append(
PaddedTrackInfo(
key=pad_result.padded_key,

View File

@@ -94,6 +94,8 @@ async def pad_track(input: PaddingInput, ctx: Context) -> PadTrackResult:
track_index=input.track_index,
)
storage_path = f"file_pipeline_hatchet/{input.transcript_id}/tracks/padded_{input.track_index}.webm"
with tempfile.NamedTemporaryFile(suffix=".webm", delete=False) as temp_file:
temp_path = temp_file.name
@@ -107,7 +109,6 @@ async def pad_track(input: PaddingInput, ctx: Context) -> PadTrackResult:
)
file_size = Path(temp_path).stat().st_size
storage_path = f"file_pipeline_hatchet/{input.transcript_id}/tracks/padded_{input.track_index}.webm"
with open(temp_path, "rb") as padded_file:
await storage.put_file(storage_path, padded_file)