ソースを参照

Revert "Fix #106"

This reverts commit e8cb5df691c7af1830241df8a2ea3fc76d4fb388.
George S. Baugh 5 年 前
コミット
b9a2d2f821
2 ファイル変更2 行追加34 行削除
  1. 1 1
      Makefile
  2. 1 33
      lib/Trog/Data/FlatFile.pm

+ 1 - 1
Makefile

@@ -15,7 +15,7 @@ reset-dummy-data:
 
 .PHONY: depend
 depend:
-	sudo apt install -y sqlite3 libsqlite3-dev libdbd-sqlite3-perl cpanminus starman  libcal-dav-perl libtext-xslate-perl libserver-starter-perl libplack-perl libcal-dav-perl libconfig-tiny-perl libdatetime-format-http-perl libjson-maybexs-perl libuuid-tiny-perl libcapture-tiny-perl libconfig-simple-perl libdbi-perl libfile-slurper-perl libfile-touch-perl libfile-copy-recursive-perl libxml-rss-perl libmodule-install-perl libio-aio-perl
+	sudo apt install -y sqlite3 libsqlite3-dev libdbd-sqlite3-perl cpanminus starman  libcal-dav-perl libtext-xslate-perl libserver-starter-perl libplack-perl libcal-dav-perl libconfig-tiny-perl libdatetime-format-http-perl libjson-maybexs-perl libuuid-tiny-perl libcapture-tiny-perl libconfig-simple-perl libdbi-perl libfile-slurper-perl libfile-touch-perl libfile-copy-recursive-perl libxml-rss-perl libmodule-install-perl
 	sudo cpanm Mojo::File Date::Format WWW::SitemapIndex::XML WWW::Sitemap::XML HTTP::Body Pod::Html URL::Encode
 	wget -O www/scripts/fgEmojiPicker.js https://github.com/woody180/vanilla-javascript-emoji-picker/raw/master/fgEmojiPicker.js
 	wget -O www/scripts/full-emoji-list.json https://github.com/woody180/vanilla-javascript-emoji-picker/raw/master/full-emoji-list.json

+ 1 - 33
lib/Trog/Data/FlatFile.pm

@@ -11,7 +11,6 @@ use JSON::MaybeXS;
 use File::Slurper;
 use File::Copy;
 use Mojo::File;
-use IO::AIO 2;
 
 use parent qw{Trog::DataModule};
 
@@ -38,40 +37,9 @@ sub read ($self, $query={}) {
     }
     $query->{limit} //= 25;
 
-    my $done = 0;
-    my $grp = aio_group sub {
-        $done = 1;
-    };
-    #TODO up the limit of group appropriately
-
-    my $contents = {};
-    my $num_read = 0;
-    @index = grep { -f } @index;
-
     my @items;
-    feed $grp sub {
-        my $file = shift @index or return;
-        add $grp (aio_slurp $file, 0, 0, $contents->{$file}, sub {
-
-            #Don't waste any time if we dont have to
-            return if scalar(@items) >= $query->{limit};
-
-            my $parsed  = $parser->decode($contents->{$file});
-
-            #XXX this imposes an inefficiency in itself, get() will filter uselessly again here later
-            my @filtered = $self->filter($query,@$parsed);
-            push(@items,@filtered) if @filtered;
-        });
-    };
-    while (@index && !$done) {
-        IO::AIO::poll_cb();
-        last if scalar(@items) == $query->{limit};
-    }
-    $grp->cancel();
-    @items = sort {$b->{created} <=> $a->{created} } @items;
-    return \@items;
-
     foreach my $item (@index) {
+        next unless -f $item;
         my $slurped = eval { File::Slurper::read_text($item) };
         if (!$slurped) {
             print "Failed to Read $item:\n$@\n";