Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item limit in emoncms HTTP interfacer should not be hard-coded #72

Open
SeanDS opened this issue Jan 4, 2019 · 0 comments
Open

Item limit in emoncms HTTP interfacer should not be hard-coded #72

SeanDS opened this issue Jan 4, 2019 · 0 comments

Comments

@SeanDS
Copy link
Contributor

SeanDS commented Jan 4, 2019

This line in the source code for the EmonHubEmoncmsHTTPInterfacer...

        # set an absolute upper limit for number of items to process per post
        self._item_limit = 250

...stops the batchsize configuration setting being set to anything higher than 250 items due to the code in emonhub_interfacer.py:

            max_items = int(self._settings['batchsize'])
            if max_items > self._item_limit:
            max_items = self._item_limit

It means I can't hold more than 250 readings in memory before sending them to a remote emoncms server.

I guess this is hard-coded to prevent too much load on emoncms.org, but I use this with a private emoncms server where I don't want this restriction. In fact, my remote emonhub lost connectivity over the holidays and after I fixed the network problem today it is now syncing two weeks worth of data (stored thanks to the default buffer size of 100,000) - but it will take forever to send it in chunks of 250 readings to catch up.

I'd like to argue against this restriction. If it's really a problem for emoncms.org then the emoncms.org server should implement some sort of limiting (pretty easy in Apache's configuration), not the client. There's nothing to stop me from modifying the source code to remove this restriction, so it's not really a defence, really just security through obscurity. And, it means my private emoncms server also has to suffer from this restriction and the above problem that resyncing after downtime will take ages.

I suggest this restriction is removed from the client code. If it's really necessary for emoncms.org, consider a server setting to limit POST size or alter the code in emonhub to only apply this restriction if the host is set to emoncms.org.

Also: it was unclear to me from the code that this limit even existed until I dug further into the class hierarchy: child classes like EmonHubEmoncmsHTTPInterfacer should not set private fields on their parents - they are supposed to be private. Use properties or set the value as part of the call to the parent's __init__.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants