Notify user if files too large
This commit is contained in:
parent
a353ee0f3b
commit
0d97e405b4
@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
# A short human readable title of the unit
|
# A short human readable title of the unit
|
||||||
Description= Keroosha.SilencerBot Prod
|
Description=Keroosha.SilencerBot Prod
|
||||||
# A list of units whose activations will occur before this unit starts.
|
# A list of units whose activations will occur before this unit starts.
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
@ -13,9 +13,13 @@ After=network.target
|
|||||||
Type=simple
|
Type=simple
|
||||||
# Command with arguments to invoke when the unit is activated.
|
# Command with arguments to invoke when the unit is activated.
|
||||||
ExecStart=/opt/apps/Keroosha.SilncerBot/app/Keroosha.SilencerBot
|
ExecStart=/opt/apps/Keroosha.SilncerBot/app/Keroosha.SilencerBot
|
||||||
|
WorkingDirectory=/opt/apps/Keroosha.SilncerBot/app
|
||||||
# Configures under what conditions the unit will be restarted.
|
# Configures under what conditions the unit will be restarted.
|
||||||
Restart=on-failure
|
User=apps
|
||||||
|
Restart=always
|
||||||
CPUQuota=15%
|
CPUQuota=15%
|
||||||
|
KillSignal=SIGINT
|
||||||
|
Environment=SILENCER_BOT_CONFIG_PATH=/opt/apps/Keroosha.SilncerBot/config/config.json
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
# A list of units who when activated will try and activate this unit
|
# A list of units who when activated will try and activate this unit
|
||||||
|
@ -121,6 +121,19 @@ let processUploading (job: UserJob, botConfig: Funogram.Types.BotConfig, config:
|
|||||||
async {
|
async {
|
||||||
let ctx = getContext job
|
let ctx = getContext job
|
||||||
let instrumentalPath, vocalsPath = getArtifactsPath ctx
|
let instrumentalPath, vocalsPath = getArtifactsPath ctx
|
||||||
|
|
||||||
|
let sizeCheck = [
|
||||||
|
FileInfo(instrumentalPath)
|
||||||
|
FileInfo(vocalsPath) ]
|
||||||
|
|> List.map (fun x -> Math.Floor(double(x.Length) / double(Math.Pow(1024, 2))))
|
||||||
|
|> List.fold (fun acc x -> acc && x < double(50)) true
|
||||||
|
|
||||||
|
match sizeCheck with
|
||||||
|
| false ->
|
||||||
|
do! TgClient.makeRequestAsync botConfig <| Api.sendMessage ctx.chatId "Не могу загрузить результаты - они весят больше 50мб"
|
||||||
|
|> Async.Ignore
|
||||||
|
return { job with State = JobState.CleanUp }
|
||||||
|
| true ->
|
||||||
use fInstrumental = File.OpenRead instrumentalPath
|
use fInstrumental = File.OpenRead instrumentalPath
|
||||||
use fVocals = File.OpenRead vocalsPath
|
use fVocals = File.OpenRead vocalsPath
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user