Code Monkey home page Code Monkey logo

team7's Introduction

team7's People

Contributors

admirallll avatar edheltur avatar fng3r avatar levshinmisha avatar mscrde avatar trszdev avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

team7's Issues

Проблема с БД

Отсутствует атомарность у upsert. Допустим, у нас есть upsertUser:

upsertUser(user):
     users = await hru.getUsers()
     users[user.index] = user
     await hru.saveUsers(users)

У нас есть user1 и user2. Вызывается Promise.all(upsertUser(user1), upsertUser(user2)), один из пользователей может не обновится, а мы об этом не узнаем.

Мелкие баги

  • img onerror (битые аватарки, изображения)
  • Скролл чатов
  • После создания группого чата надо в него переходить
  • лайтбокс смайликов в edge
  • VPN + team7chat.now.sh за 5 реконнектов подключается к сокету
  • Метадата у нашего сайта от гитхаба из-за редиректов
  • Не работают ссылки https://team7chat.now.sh/#me если заходим не залогинеными(редиректит на /)
  • scroll + image в чате

Код для построения гистограм по hrudb-stats.csv

from itertools import chain
from csv import reader
from glob import glob
from typing import Iterable, Tuple, Any
from datetime import datetime
from dateutil.parser import parse
import matplotlib.pyplot as plt


class CsvItems:
    __slots__ = 'request_type', 'date', 'response_ms', 'code'

    def __init__(self, request_type: str, date: datetime, response_ms: int, code: int):
        self.request_type = request_type
        self.date = date
        self.response_ms = response_ms
        self.code = code


def read_csvs() -> Iterable[str]:
    for csv_name in glob('./*.csv'):
        with open(csv_name) as csv_file:
            csv_reader = reader(csv_file)
            yield from csv_reader


def parse_csv_items(items: Tuple[Any, ...]) -> CsvItems:
    request_type, date, response_ms, code = items
    date = parse(date)
    response_ms, code = map(int, (response_ms, code))
    return CsvItems(request_type, date, response_ms, code)


def main():
    data = [*map(parse_csv_items, read_csvs())]
    gets = [x for x in data if x.request_type == 'GET']
    posts = [x for x in data if x.request_type == 'POST']
    puts = [x for x in data if x.request_type == 'PUT']
    deletes = [x for x in data if x.request_type == 'DELETE']

    for i, label, data in (
            (0, 'GET', gets),
            (1, 'POST', posts),
            (2, 'PUT', puts),
            (3, 'DELETE', deletes)
    ):

        plt.subplot(4, 2, 2*i + 1)
        plt.hist([x.response_ms for x in data], color='blue')
        plt.title(label)
        plt.xlabel('Response time(ms)')
        plt.yscale('log')
        plt.ylabel('Frequency')

        plt.subplot(4, 2, 2*i + 2)
        plt.hist([x.code for x in data], color='orange')
        plt.title(label)
        plt.xlabel('Http code')
        plt.yscale('log')
        plt.ylabel('Frequency')
    plt.tight_layout(1)
    plt.show()


if __name__ == '__main__':
    main()

requirements.txt:

matplotlib==2.1.2
python-dateutil==2.6.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.