From 68ccb8a49410fc6657726be5241f0e14e99bd10e Mon Sep 17 00:00:00 2001 From: Athos Ribeiro Date: Tue, 8 Mar 2016 15:54:11 -0300 Subject: [PATCH] Remove forking from module --- README.md | 8 ++++++-- lib/CoprStatus.pm | 5 ----- util/update_files.pl | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 util/update_files.pl diff --git a/README.md b/README.md index d620473..125634b 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,9 @@ > This app was built to support the development of Portal do Software Público Brasileiro. It shows versions for published packages in EPEL7 Fedora Copr -repositories. Note that this app consists of a single package (CoprStatus), a -PSGI script, a template file and Bootstrap. +repositories. Note that this app consists of a package (CoprStatus), a +PSGI script, a script to update information on .spec files, a template file +and Bootstrap. ---- # Development @@ -48,6 +49,9 @@ plackup [--port PORT_NUMBER] -Ilib plackup -Ilib ``` +> There is a util/update_files.pl file that must be running +in order to update spec files. + ---- # Configuration diff --git a/lib/CoprStatus.pm b/lib/CoprStatus.pm index cb96018..2c27947 100644 --- a/lib/CoprStatus.pm +++ b/lib/CoprStatus.pm @@ -192,9 +192,4 @@ sub serve_json_status { ]; }; -my $child_pid = fork(); -if($child_pid) { - update_files(); -} - 1; diff --git a/util/update_files.pl b/util/update_files.pl new file mode 100644 index 0000000..9f84366 --- /dev/null +++ b/util/update_files.pl @@ -0,0 +1,20 @@ +use CoprStatus; +use YAML::XS 'LoadFile'; + +my $config = LoadFile('config.yaml'); + +sub update_files { + while(1) { + my $user = $config->{User}; + my $repo_index = 0; + foreach my $branch (@{$config->{Branches}}) { + CoprStatus::download_specs($branch, $user, ${$config->{Repositories}}[$repo_index]); + $repo_index += 1; + } + + sleep $config->{UpdateRate}; + } +} + +update_files(); + -- libgit2 0.21.2