Turn off file watching in Meteor
Asked Answered
I

4

7

I am building an app that stores user generated images. These images get used throughout the app in a gallery type view. They also update/regenerate frequently.

The problem I am having is when a new image gets generated, I am storing it in the public directory. This causes the meteor server to "restart".

Is there a way to turn off file watching?

Impanation answered 10/4, 2013 at 20:49 Comment(3)
possible duplicate of How to prevent Meteor from watching files?Scrape
How did you even manage to ask this without finding the duplicate and the link to github.com/meteor/meteor/issues/437Scrape
@Scrape - well, it didn't pop up while typing the question. I did see many similar questions later, but none of them had a good answer, so I left it up.Impanation
I
0

I ended up exporting the file to an S3 bucket so that it didn't effect the Meteor watching.

Impanation answered 28/8, 2013 at 21:5 Comment(0)
N
2
  1. I don't think it is possible as for now

  2. Even if you could stop to watch it would not solve your issue

When meteor detect a change it rebuild the server (.meteor/local/build/) and serve it from there.

Public folder is sent there : ".meteor/local/build/static/"

In a case where you would stop watching for updates you would also stop to see changes in what your client can access.

I found out that this particular case can be solved by replacing meteor by another tool to deal with static assets.

I have a meteor app to deal with data and file sync, but I also keep an Apache to serve as a file distribution manager.

My meteor app keep small, assets can be sent somewhere else (Ex.: S3 when you get in production).

Nigrify answered 11/4, 2013 at 13:41 Comment(0)
V
1

I just found an answer on a similar question on this website that I think might help if you haven't found a solution yet.

I finally found a workaround. I'm putting everything in /public/lib/. Then, line 286 of /usr/lib/meteor/app/run.js, I'm adding the folder I don't want Meteor to watch: self.exclude_paths = [ path.join(app_dir, '.meteor', 'local'), path.join(app_dir, 'public', 'lib') ]; This way I can have as much files as I want in lib, and they don't slow everything down. include path is '/lib/dojo/dojo.js'.

by Mathieu

Venuti answered 22/4, 2013 at 8:37 Comment(1)
As for 2023, can't make it work. I can't find /usr/lib/meteor/app/run.js; my Meteor runs from /home/user/.meteor, hope it is proper folder. But I can't locate app/run.js and can't grep the "exclude_paths" line.Elly
I
0

I ended up exporting the file to an S3 bucket so that it didn't effect the Meteor watching.

Impanation answered 28/8, 2013 at 21:5 Comment(0)
O
0

I like to use develop mode for small-mid project as well, saving files to /public is terrible idea.

Recommand Meteor-Files Save all files like json data into the mongodb or s3, and use it like the file you have in local.

Orator answered 1/12, 2020 at 0:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.