skylines icon indicating copy to clipboard operation
skylines copied to clipboard

[Feature] Support from_time for the /tracking/<user_ids> endpoint

Open vicb opened this issue 3 years ago • 7 comments

This feature request is similar to how /tracking/<user_id>/json supports a last_update parameter to only fetch the latest points... but a bit different.

The idea is to be able to request the updates for a group of pilots from a given time so last_update should be a timestamp (number of seconds since January 1, 1970 12:00:00 AM).

The way last_update is implemented in /tracking/<user_id>/json would not work. That's because in this case last_update is the number of seconds since prior midnight UTC of the first track point.

Let's say pilotA starts flying at 23:30 UTC and pilotB starts flying at 00:30 UTC then their reference day would be different and there is no one last_update value that is common to both. Making last_update a timestamp for the /tracking/<user_ids> endpoint would solve this.

Context: I am revamping the SkyLines tracker support into flyxc.app.

Thanks !

vicb avatar Nov 05 '20 20:11 vicb

Hey @Turbo87 do you think this is a good idea ?

Would you merge this if I create a PR ?

The query parameter could be called from_time and take a UNIX timestamp. It could be added to the endpoints:

  • /tracking/latest.json
  • /live/<user_ids>
  • /live/<user_id>/json in complement of the already existing last_update.

The advantage would be that I don't have to pull 12h of track every time I retrieve positions from Skylines. It would save bandwidth and CPU.

What do you think ?

vicb avatar Nov 24 '20 17:11 vicb

seems like a reasonable request. I'm a little worried about breaking the existing code though, so it would be great if you could ensure that we have decent test coverage for these endpoints before modifying them. 🙏

Turbo87 avatar Nov 30 '20 14:11 Turbo87

Thanks @Turbo87 I'll give it a try.

I am having troubles installing the Vagrant env.

On the first vagrant up I get the error default: Failed to fetch http://ppa.launchpad.net/jonathonf/python-2.7/ubuntu/dists/trusty/main/binary-amd64/Packages 403 Forbidden [IP: 91.189.95.83 80]. A second vagrant up goes through but I suspect I have missing dependencies.

Do you have updated instructions on how to setup the development environment and run the tests ?

Thanks, Vic

vicb avatar Nov 30 '20 16:11 vicb

I haven't run if for a while. It's possible that some dependency update broke it... 😞

welcome to the rabbit hole 🎉

Turbo87 avatar Nov 30 '20 16:11 Turbo87

I can try to investigate this.

How do you debug the server ?

What are the steps to install the python deps an run the tests ?

I guess pipenv install --dev and then ?

vicb avatar Nov 30 '20 16:11 vicb

How do you debug the server ?

depends on what exactly you mean by that

What are the steps to install the python deps an run the tests ?

https://github.com/skylines-project/skylines/blob/2a6c948ed60dc7e4a9489b659622289b54e152f6/.github/workflows/ci.yml#L114-L119 should give a few hints.

Turbo87 avatar Nov 30 '20 17:11 Turbo87

I have hacked a working config using https://github.com/nektos/act

Using the comand:

$ act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -j backend

I should be able to make some progress with that.

Thanks for your help.

vicb avatar Nov 30 '20 19:11 vicb