Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F21907119
publisher_worker.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
882 B
Referenced Files
None
Subscribers
None
publisher_worker.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Workers.PublisherWorker
do
alias
Pleroma.Activity
alias
Pleroma.Web.Federator
use
Pleroma.Workers.WorkerHelper
,
queue
:
"federator_outgoing"
def
backoff
(
attempt
)
when
is_integer
(
attempt
)
do
Pleroma.Workers.WorkerHelper
.
sidekiq_backoff
(
attempt
,
5
)
end
@impl
Oban.Worker
def
perform
(%{
"op"
=>
"publish"
,
"activity_id"
=>
activity_id
},
_job
)
do
activity
=
Activity
.
get_by_id
(
activity_id
)
Federator
.
perform
(
:publish
,
activity
)
end
def
perform
(%{
"op"
=>
"publish_one"
,
"module"
=>
module_name
,
"params"
=>
params
},
_job
)
do
params
=
Map
.
new
(
params
,
fn
{
k
,
v
}
->
{
String
.
to_atom
(
k
),
v
}
end
)
Federator
.
perform
(
:publish_one
,
String
.
to_atom
(
module_name
),
params
)
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sun, Dec 28, 1:41 AM (11 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
733820
Default Alt Text
publisher_worker.ex (882 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment