noosfero | Html5VideoPlugin: extracts conversion jobs to script (!1308)

Gabriel Silva gitlab at mg.gitlab.com
Thu Sep 21 15:33:58 BRT 2017


Gabriel Silva commented on a discussion on plugins/html5_video/script/video_processor_foreground.rb:

> +end
> +
> +# Watches pool dir using inotifywait
> +def watch_pool
> +  IO.popen("inotifywait -r -m -e create #{POOL_DIR}") do |output|
> +    output.each do |line|
> +      path, events, filename = line.split
> +      if events.include? 'ISDIR'
> +        # A subfolder for the environment was created.
> +        env_id = filename
> +      else
> +        # A new file was added
> +        env_id = path.split('/').last
> +      end
> +
> +      # inotify may lose some events, so run for all files every time

We can spawn another process that will check the pool every hour or so, but I think `inotify` losing events is an edge case that only happens with files in recently created folders. E.g., `folder1` is created, and before `inotify` starts watching it `folder1/file1` was created. In this case we only get an event for `folder1`.

In this pool, it only happens when a folder for the environment/stage is created, that is, the first video being uploaded in that environment. Even so, the video will probably be processed because the folder event still triggers the processing for all files, so I'm not sure if it is necessary.

---
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1308#note_41030446
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170921/e4bb9197/attachment-0001.html>


More information about the Noosfero-dev mailing list