bridgetownrb/bridgetown-feed

Site with ~50 pages takes 20 seconds to generate feed

joemasilotti opened this issue · 2 comments

My site constantly takes 20 seconds to generate the XML feed. There are only about 50 pages and I don't think I'm doing anything crazy.

Codebase is open source, here: https://github.com/joemasilotti/masilotti.com

Recent server log when editing a file. Note how the site rebuilds in 0.01 seconds but the sitemap takes over 20.

[Bridgetown]          Reloading… 1 file changed at 2023-02-09 08:38:18
[Bridgetown]                     - src/_posts/2023-02-09-progressively-enhanced-turbo-native-apps-in-the-app-store.md
[Bridgetown]             Done! 🎉 Completed in less than 0.01 seconds.
[Bridgetown]
[Frontend] esbuild: frontend bundling started...
[Frontend] esbuild: frontend bundling complete!
[Frontend] esbuild: entrypoints processed:
[Frontend]          - index.QOLPUBLY.js: 487B
[Frontend]          - index.RPH5C6P5.css: 44.51KB
[Bridgetown]          Reloading… 1 file changed at 2023-02-09 08:38:19
[Bridgetown]                     - .bridgetown-cache/frontend-bundling/manifest.json
[Bridgetown]    Bridgetown Feed: Generating feed for hotwire
[Bridgetown]    Bridgetown Feed: Generating feed for posts
[Bridgetown]         Pagination: disabled. Enable in site config with pagination:\n enabled: true
[Bridgetown]             Done! 🎉 Completed in less than 20.37 seconds.
[Bridgetown]

For now I'm disabling sitemap and feed generation in development via this commit.

commit d1a684609862b0ccdd21347f4983efa30f7933d4
Author: Joe Masilotti <joe@masilotti.com>
Date:   Thu Feb 9 10:10:12 2023 -0800

    Only build sitemap + feed in production
    
    Because it takes 20+ seconds in dev for every tweak :(

diff --git a/config/initializers.rb b/config/initializers.rb
index f628228..d24cd7c 100644
--- a/config/initializers.rb
+++ b/config/initializers.rb
-  init :"bridgetown-sitemap" 
+  unless Bridgetown.env.development?
+    init :"bridgetown-feed"
+    init :"bridgetown-sitemap"
+  end
diff --git a/src/_components/head.erb b/src/_components/head.erb
index 29c8005..2f12ba8 100644
--- a/src/_components/head.erb
+++ b/src/_components/head.erb
@@ -20,7 +20,9 @@
-<%= feed_meta %>
+<% unless Bridgetown.env.development? %>
+  <%= feed_meta %>
+<% end %>

Whoops! I posted this in the wrong repo.

Closing in favor of this issue.