Skip to content

Instantly share code, notes, and snippets.

View merlijn-sebrechts's full-sized avatar
🏳️‍🌈
🐼 🦁 ❤️

Merlijn Sebrechts merlijn-sebrechts

🏳️‍🌈
🐼 🦁 ❤️
View GitHub Profile
@merlijn-sebrechts
merlijn-sebrechts / get_reviews.py
Last active July 16, 2021 14:43
Get all reviews of a snap
#! /usr/bin/env python3
#
# Run this script to get all reviews of a single snap.
#
#%%
from datetime import datetime
import getpass
import hashlib
import json
import requests
App without fix with fix reduction
SDLPoP 1.146s 0.675s 40%
Foliate 0.848s 0.619s 27%
KCalc 2.980s 2.673s 10%

SDLPoP

@merlijn-sebrechts
merlijn-sebrechts / departing-relations.md
Last active February 22, 2017 12:41
Clean Departure of relations

Q: I have two applications that are connected to each other. When I remove the relationship, the order in which both applications terminate the relationship is very important. The client side needs to terminate the relationship before the server side, else, the client will try to connect to a nonexistent server and fail. How Can I do that?

A: This is where the <relation>-departed and <relation>-broken flags come in. The relation-departed flag will be set immediately after the removal of the relationship is requested. This flag should be used to trigger a termination from the client side. Only when every related unit has handled the relation-departed flag, the relation-broken flag will be called. This means that the server side of the relationship knows that every client has disconnected when the relation-broken flag is set.

Client side:

@when('server.relation-departed')
def handle_server_departed(server_relation):
    stop_client(server_relation)