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

[BUG] Seems to be a slight memory issue #666

Closed
1 task done
Jason2605 opened this issue Sep 28, 2023 · 3 comments · Fixed by #691
Closed
1 task done

[BUG] Seems to be a slight memory issue #666

Jason2605 opened this issue Sep 28, 2023 · 3 comments · Fixed by #691
Labels
bug Something isn't working

Comments

@Jason2605
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

import HTTP;

class Weather {
    const API_URL = 'http://api.weatherapi.com/v1';

    init (private apiKey) {}

    getCurrentWeather() {
        const response = HTTP.get(
            "{}/current.json?key={}&q=London&aqi=no".format(Weather.API_URL, this.apiKey)
        ).unwrap();

        const data = response.json().unwrap()["current"];

        return {
            "temp": data["temp_c"],
            "condition": data["condition"]["text"],
        };
    }
    getTodaysForcast() {
        const response = HTTP.get(
            "{}/forecast.json?key={}&q=London&aqi=no&days=1".format(Weather.API_URL, this.apiKey)
        ).unwrap();

        return response.content;
    }
}

print(Weather("key").getTodaysForcast());

// Total bytes lost: 1

Expected Behavior

No response

Steps To Reproduce

No response

Anything else?

No response

@Jason2605 Jason2605 added the bug Something isn't working label Sep 28, 2023
@briandowns
Copy link
Contributor

How did you make that determination? I'm curious for my own future troubleshooting knowledge.

@Jason2605
Copy link
Member Author

Issue is a bit bare sorry, I need to put more info onto these things. As for determination do you mean the amount of bytes lost? If so, build Dictu in debug mode and it'll display that message after you run the script.

The issue itself is on large HTTP responses and having to resize the string from a little look into it

@briandowns
Copy link
Contributor

Awesome. That's what I was curious about. Thanks!

@Jason2605 Jason2605 mentioned this issue Nov 1, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants