Skip to content

fix: rewrite for memory efficiency#23

Open
Jaarabytes wants to merge 1 commit into
horahoradev:mainfrom
Jaarabytes:main
Open

fix: rewrite for memory efficiency#23
Jaarabytes wants to merge 1 commit into
horahoradev:mainfrom
Jaarabytes:main

Conversation

@Jaarabytes

Copy link
Copy Markdown

Rewrite Upload func to reuse the same buffer chunk (using defer and Close) increasing memory efficiency

Add maxThumbnailSize; (you can customize to whichever value you see fit)

@horahoradev

Copy link
Copy Markdown
Owner

oh shit we have a pr lmao
just ping me next time if i don't respond

if err != nil {
return err
}
defer func() {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

what's going on here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hello, just realized that they are redundant and unnecessary.

I should have rewritten to (since the code is closing the video and thumb files which have just been opened):

defer thumbFile.Close()


defer videoFile.Close()

@horahoradev

Copy link
Copy Markdown
Owner

looks fine to me tbh, just not sure about the initial defers

@Jaarabytes

Copy link
Copy Markdown
Author

Heyy, you can get rid of them/rewrite them

Also, sorry for the late reply (was on long vacation)

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.

2 participants