Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matrix-media-repo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
matrix-media-repo
Commits
a2fca74c
Commit
a2fca74c
authored
1 year ago
by
Travis Ralston
Browse files
Options
Downloads
Patches
Plain Diff
Don't calculate blurhashes on things we wouldn't thumbnail
parent
fa60acef
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pipelines/_steps/upload/blurhash_async.go
+4
-1
4 additions, 1 deletion
pipelines/_steps/upload/blurhash_async.go
pipelines/pipeline_upload/pipeline.go
+1
-1
1 addition, 1 deletion
pipelines/pipeline_upload/pipeline.go
with
5 additions
and
2 deletions
pipelines/_steps/upload/blurhash_async.go
+
4
−
1
View file @
a2fca74c
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
"github.com/turt2live/matrix-media-repo/database"
"github.com/turt2live/matrix-media-repo/database"
)
)
func
CalculateBlurhashAsync
(
ctx
rcontext
.
RequestContext
,
reader
io
.
Reader
,
sha256hash
string
)
chan
struct
{}
{
func
CalculateBlurhashAsync
(
ctx
rcontext
.
RequestContext
,
reader
io
.
Reader
,
sizeBytes
int64
,
sha256hash
string
)
chan
struct
{}
{
var
err
error
var
err
error
opChan
:=
make
(
chan
struct
{})
opChan
:=
make
(
chan
struct
{})
go
func
()
{
go
func
()
{
...
@@ -21,6 +21,9 @@ func CalculateBlurhashAsync(ctx rcontext.RequestContext, reader io.Reader, sha25
...
@@ -21,6 +21,9 @@ func CalculateBlurhashAsync(ctx rcontext.RequestContext, reader io.Reader, sha25
if
!
ctx
.
Config
.
Features
.
MSC2448Blurhash
.
Enabled
{
if
!
ctx
.
Config
.
Features
.
MSC2448Blurhash
.
Enabled
{
return
return
}
}
if
ctx
.
Config
.
Thumbnails
.
MaxSourceBytes
<=
sizeBytes
{
return
}
var
img
image
.
Image
var
img
image
.
Image
img
,
err
=
imaging
.
Decode
(
reader
)
img
,
err
=
imaging
.
Decode
(
reader
)
...
...
This diff is collapsed.
Click to expand it.
pipelines/pipeline_upload/pipeline.go
+
1
−
1
View file @
a2fca74c
...
@@ -150,7 +150,7 @@ func Execute(ctx rcontext.RequestContext, origin string, mediaId string, r io.Re
...
@@ -150,7 +150,7 @@ func Execute(ctx rcontext.RequestContext, origin string, mediaId string, r io.Re
}
}
// Step 10: Asynchronously calculate blurhash
// Step 10: Asynchronously calculate blurhash
bhChan
:=
upload
.
CalculateBlurhashAsync
(
ctx
,
bhR
,
sha256hash
)
bhChan
:=
upload
.
CalculateBlurhashAsync
(
ctx
,
bhR
,
sizeBytes
,
sha256hash
)
// Step 11: Asynchronously upload to cache
// Step 11: Asynchronously upload to cache
cacheChan
:=
upload
.
PopulateCacheAsync
(
ctx
,
cacheR
,
sizeBytes
,
sha256hash
)
cacheChan
:=
upload
.
PopulateCacheAsync
(
ctx
,
cacheR
,
sizeBytes
,
sha256hash
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment