def get_remotesettings_timestamp()

in cronjobs/src/commands/sync_megaphone.py [0:0]


def get_remotesettings_timestamp(uri):
    client = KintoClient(server_url=uri)
    changeset = client.get_changeset(
        bucket="monitor", collection="changes", bust_cache=True
    )
    # We want to filter out preview entries, because we don't want to notify all clients
    # when a review is requested. Therefore we can't use the `timestamp` field and must
    # get it from filtered entries.
    # https://github.com/mozilla/remote-settings/blob/45841c04/kinto-remote-settings/src/kinto_remote_settings/changes/views.py#L40-L44
    return str(
        max(
            e["last_modified"]
            for e in changeset["changes"]
            if "-preview" not in f"{e['bucket']}/{e['collection']}"
        )
    )