Skip to content

/boxes?date= returns nothing #107

Open

Description

@noerw

https://api.opensensemap.org/boxes?date=2017-08-06T00:00:00Z,2017-08-10T12:49:51Z

Activity

  1. noerw commented on Aug 24, 2017

    @noerw
    MemberAuthor

    sometimes an empty response is returned, sometimes

    {"code":"InternalServerError","message":"connection 16 to 172.31.46.193:27017 timed out"}
    
  2. ubergesundheit commented on Aug 24, 2017

    @ubergesundheit
    Member

    Seems the aggregation executed when requesting the route with date parameters does not receive data in time thus timing out. (

    execStreamBoxesToClientPromise = Measurement.aggregate([
    {
    $match: {
    createdAt: {
    '$gt': fromDate.toDate(),
    '$lt': toDate.toDate()
    }
    }
    },
    {
    $group: {
    _id: '$sensor_id',
    value: { $first: '$value' },
    createdAt: { $first: '$createdAt' },
    sensor_id: { $first: '$sensor_id' }
    },
    },
    { $project: { value: 1, createdAt: 1, sensor_id: 1, _id: 0 } }
    ])
    )

    I have no particular plans, but in the long run I have to think about speeding up the aggregation or using some trick to cache the information if there is data for a particular timeframe or not.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions