Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recording/change s3 on close mechanism #388

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

Karolk99
Copy link
Contributor

No description provided.

@Karolk99 Karolk99 force-pushed the recording/change-s3-on-close-mechanism branch from 3cecc3c to f587874 Compare April 16, 2024 12:01
Copy link

codecov bot commented Apr 16, 2024

Codecov Report

Merging #388 (5670818) into master (044950f) will increase coverage by 0.12%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #388      +/-   ##
==========================================
+ Coverage   54.04%   54.17%   +0.12%     
==========================================
  Files          74       75       +1     
  Lines        3249     3258       +9     
==========================================
+ Hits         1756     1765       +9     
  Misses       1493     1493              
Files Coverage Δ
recording/lib/storage/s3.ex 94.82% <100.00%> (+0.38%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 044950f...5670818. Read the comment docs.

Comment on lines 163 to 186
defp stream_object(file_path, config, storage_opts) do
path_prefix = Map.get(storage_opts, :path_prefix, "")
path = Path.join([path_prefix, config.filename])
credentials = storage_opts.credentials
aws_config = create_aws_config(credentials)

result =
file_path
|> ExAws.S3.Upload.stream_file()
|> ExAws.S3.upload(credentials.bucket, path)
|> ExAws.request(aws_config)

case result do
{:ok, %{status_code: 200}} ->
:ok

{:error, response} ->
Membrane.Logger.error(
"Couldn't stream object on S3 bucket, recording id: #{config.recording_id}"
)

{:error, response}
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty similar to save_object, only the inner path is different. Could we avoid duplication of the code?

@Karolk99 Karolk99 merged commit b2791b0 into master Apr 16, 2024
24 checks passed
@Karolk99 Karolk99 deleted the recording/change-s3-on-close-mechanism branch April 16, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants