Commit 68ccb8a49410fc6657726be5241f0e14e99bd10e

Authored by Athos
1 parent 2def8b9f
Exists in master

Remove forking from module

There is a update_files.pl script in the utils directory, which must be
running in background in order to update the spec files.
@@ -13,8 +13,9 @@ @@ -13,8 +13,9 @@
13 13
14 > This app was built to support the development of Portal do Software Público 14 > This app was built to support the development of Portal do Software Público
15 Brasileiro. It shows versions for published packages in EPEL7 Fedora Copr 15 Brasileiro. It shows versions for published packages in EPEL7 Fedora Copr
16 -repositories. Note that this app consists of a single package (CoprStatus), a  
17 -PSGI script, a template file and Bootstrap. 16 +repositories. Note that this app consists of a package (CoprStatus), a
  17 +PSGI script, a script to update information on .spec files, a template file
  18 +and Bootstrap.
18 19
19 ---- 20 ----
20 # Development 21 # Development
@@ -48,6 +49,9 @@ plackup [--port PORT_NUMBER] -Ilib @@ -48,6 +49,9 @@ plackup [--port PORT_NUMBER] -Ilib
48 plackup -Ilib 49 plackup -Ilib
49 ``` 50 ```
50 51
  52 +> There is a util/update_files.pl file that must be running
  53 +in order to update spec files.
  54 +
51 ---- 55 ----
52 # Configuration 56 # Configuration
53 57
lib/CoprStatus.pm
@@ -192,9 +192,4 @@ sub serve_json_status { @@ -192,9 +192,4 @@ sub serve_json_status {
192 ]; 192 ];
193 }; 193 };
194 194
195 -my $child_pid = fork();  
196 -if($child_pid) {  
197 - update_files();  
198 -}  
199 -  
200 1; 195 1;
util/update_files.pl 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +use CoprStatus;
  2 +use YAML::XS 'LoadFile';
  3 +
  4 +my $config = LoadFile('config.yaml');
  5 +
  6 +sub update_files {
  7 + while(1) {
  8 + my $user = $config->{User};
  9 + my $repo_index = 0;
  10 + foreach my $branch (@{$config->{Branches}}) {
  11 + CoprStatus::download_specs($branch, $user, ${$config->{Repositories}}[$repo_index]);
  12 + $repo_index += 1;
  13 + }
  14 +
  15 + sleep $config->{UpdateRate};
  16 + }
  17 +}
  18 +
  19 +update_files();
  20 +