profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/technikyle/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Kyle Rokita technikyle Ginger Labs San Francisco, CA http://www.technikyle.com

Ginger-Labs/DeepDiff 0

🦀Amazingly incredible extraordinary lightning fast diffing in Swift

Ginger-Labs/onedrive-sdk-ios 0

OneDrive SDK for iOS

technikyle/BinaryJSON 0

Pure Swift library for BSON

technikyle/bookshelf 0

A simple Node.js ORM for PostgreSQL, MySQL and SQLite3 built on top of Knex.js

issue openedvapor/multipart-kit

Decoding optional type cause error

Describe the bug

This oen works:

let foo = try FormDataDecoder().decode(Foo.self, from: data, boundary: "12345")

this one isn't working

let foo = try FormDataDecoder().decode(Foo?.self, from: data, boundary: "12345")

Error:

caught error: "typeMismatch(MultipartKit.OrderedDictionary<Swift.String, MultipartKit.MultipartFormData>, Swift.DecodingError.Context(codingPath: [], debugDescription: "expected single value but encountered dictionary", underlyingError: nil))"

To Reproduce

You can adjust func testFormDataDecoderW3() to see this behaviour

Expected behavior

Content should be decoded no matter if type is Foo.self or Foo?.self

Environment

Tested od mian branch

created time in 8 hours

push eventvapor/vapor

Mads Odgaard

commit sha 71d49a90543156a7ee9bc7ed18802dd78d3b6ec2

Add async websocket APIs (#2643)

view details

push time in 10 hours

delete branch vapor/vapor

delete branch : websocket-async

delete time in 10 hours

PR merged vapor/vapor

Add async websocket APIs

Adds support for async websocket routes and upgrading of existing requests.

+74 -0

2 comments

1 changed file

madsodgaard

pr closed time in 10 hours

pull request commentvapor/vapor

Add async websocket APIs

D'oh I thought this was websocket kit 😆

madsodgaard

comment created time in 10 hours

pull request commentvapor/vapor

Add async websocket APIs

@0xTim The base branch is your async-await branch, should we not just gather all async-await stuff in that branch?

madsodgaard

comment created time in 10 hours

PR opened vapor/vapor

Add async websocket API's

Adds support for async websocket routes and upgrading of existing requests.

+74 -0

0 comment

1 changed file

pr created time in 11 hours

create barnchvapor/vapor

branch : websocket-async

created branch time in 11 hours

push eventvapor/websocket-kit

Mads Odgaard

commit sha 163143d6208786d0787fcc2d2723eb06aa911ddb

Add async APIs for callbacks

view details

push time in 11 hours

Pull request review commentvapor/websocket-kit

Add support for async/await

 let package = Package(             .product(name: "NIOHTTP1", package: "swift-nio"),             .product(name: "NIOSSL", package: "swift-nio-ssl"),             .product(name: "NIOWebSocket", package: "swift-nio"),+            .product(name: "_NIOConcurrency", package: "swift-nio"),+        ], swiftSettings: [

These should only be applied to the top level Package.swift (i.e. the one with the executable in it)

madsodgaard

comment created time in a day

PR opened vapor/websocket-kit

Add support for async/await

Adds support for async/await variants of various functions

+47 -0

0 comment

2 changed files

pr created time in a day

create barnchvapor/websocket-kit

branch : concurrency

created branch time in a day

issue commentvapor/vapor

Possible memory "leak" under Linux

Right, so as linked above jemalloc will slowly burn down freed memory over time, as the allocator is entered. A single request does not diagnose a leak. Try using the application consistently: I'd expect to see that long-term memory usage is flat.

gipfelen

comment created time in a day

issue commentvapor/vapor

Possible memory "leak" under Linux

@Lukasa currently I'm testing it with Docker on macOS, where the VM is limited to 2GB of RAM. The CPU usage of the container is below 0.0% thus it also should be idling.

@obliqueRotationMethod I tried to change it to 'libjemalloc-dev', but the behavior stays the same.

gipfelen

comment created time in a day

issue commentvapor/vapor

Possible memory "leak" under Linux

@gipfelen Try changing 'libjemalloc2' to 'libjemalloc-dev' in the Dockerfile. This night I also saw that my App started crashing again when using libjemalloc2. Have rebuild it with libjemalloc-dev this morning and RAM is looking fine again

gipfelen

comment created time in a day

issue commentvapor/vapor

Possible memory "leak" under Linux

Also, is the application fully idle? If so, this is a known behaviour of jemalloc: jemalloc/jemalloc#1398

gipfelen

comment created time in a day

issue commentvapor/vapor

Possible memory "leak" under Linux

How much RAM is present on your system?

gipfelen

comment created time in a day

issue commentvapor/vapor

Possible memory "leak" under Linux

I changed my https://github.com/gipfelen/vaporLinuxLeak such that it uses jemalloc instead of malloc. But after a single call of http://localhost:8080/hello it uses more than 800MB of RAM, and it doesn't get freed (even after 5min +).

gipfelen

comment created time in 2 days

issue commentvapor/vapor

Possible memory "leak" under Linux

I had a similar issue, memory use increased over time using Linux until the app crashed while the same code had no issues on macOS. I was able to solve this by implementing jemalloc in my container

Deployed my Vapor Docker Container on CloudFoundry with 1GB RAM allocated. Since last week I tested my code under production conditions, decoding an 15MB-ish JSON every hour and writing this data to an internal Fluent SQLite DB. I noticed that now over time more and more RAM was used until the container crashed. @Lukasa mentioned jemalloc, hence I googled a bit and found that some other communities had similar issues and overcame them by using this allocator. Using jemalloc my RAM is looking great, after 24hours at about 80MB used. Previously it would have crashed 3 times by now.

My Dockerfile: [...]

================================

Run image

================================

FROM swift:5.4-focal-slim

Make sure all system packages are up to date.

RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true &&
apt-get -q update && apt-get -q dist-upgrade -y && apt-get -y install libjemalloc2 && rm -r /var/lib/apt/lists/*

ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so**

[...]

gipfelen

comment created time in 2 days

issue commentvapor/toolbox

Valid form for `--template, -T`?

@marc-medley vapor new vapor_template_apiweb --template https://github.com/VaporExamplesLab/VaporApiWebTemplate should work

marc-medley

comment created time in 2 days

pull request commentvapor/vapor

Add support for async/await

@lmcd In short absolutely not.

First, these APIs are additional and gated behind availability checks. This won't stop you using Vapor on older OSes and Vapor 4 will work just as before.

Second, async/await is the most important change in server-side Swift since it was open sourced. Holding off on adopting would be the death of Vapor as people want to migrate to it and will choose other frameworks. We need to do what's best for the community as a whole and it's not feasible to hold back when the majority of users want and can use async/await

@rleconte the aim is to do this in Vapor 4

0xTim

comment created time in 2 days

PR opened vapor/vapor

Add new reason to empty body validation

<!-- 🚀 Thank you for contributing! -->

<!-- Describe your changes clearly and use examples if possible. -->

<!-- When this PR is merged, the title and body will be --> <!-- used to generate a release automatically. -->

+1 -1

0 comment

1 changed file

pr created time in 3 days

issue openedvapor/vapor

Add async/await support for WebSockets

HTTP route handlers now have experimental support for the new async/await features in Swift 5.5. However, WebSockets miss this functionality.

This means, that non blocking work for websockets still requires the use of EventLoopFutures, that tends to lead to harder to read code.

Please also add a version of the RoutesBuilder .webSocket and WebSocket .onText methods that create/support an async context.

created time in 3 days

pull request commentvapor/vapor

Add support for async/await

Is it worth holding off on this for now? I and others I know are using Vapor (client and server features) on Apple platforms in which several years of OS support are required.

Vapor adopting async/Swift concurrency features will prevent us from using the latest Vapor releases for another year or two.

See: https://forums.swift.org/t/will-swift-concurrency-deploy-back-to-older-oss/49370/160

As far as I understand, this PR adds async/await support, but doesn't remove the current way of doing things (much like in Apple own APIs, an async variant of APIs is added on top of existing ones). So Vapor would make the async APIs available if your current swift version is adequate, and not bother you if it is not.
But I may very well be completely wrong 😅

The thing I'm not sure to understand is if this will be merged into Vapor 4 in an upcoming minor version, of be merged in an upcoming Vapor 5 ? 🤔

With that being said, even if this comes as a breaking change in Vapor 5 and you need to have the new Swift version supporting concurrency to use it, I think it is fine, and people who want to deploy to older macOS versions can still use Vapor 4, and should not prevent people deploying on macOS 12, Linux (or in docker for that matter) to have these improvements as soon as possible rather than in a few years. Especially as Swift structured concurrency looks to be a pretty big improvement for server side swift.

0xTim

comment created time in 3 days

issue closedvapor/vapor

Possibility to set static TimeZone or ignore TimeZone

Is your feature request related to a problem? Please describe. I'm try to set up a website with Events, for which the TimeZone of the Date does not matter. Right now, viewing from different timezones always shows different times. I've set the Website to always set UTC with the right date and then save it.

Describe the solution you'd like Setting the date via #date(date, "YYYY-mm-dd HH:mm", static) or #date(date, "YYYY-mm-dd HH:mm", TimeZone: 0) or similar

Describe alternatives you've considered I've tried to edit the Date on the Server before showing it on the website, but could not get it to work. I have an Event Model which gets passed as the model or even a model array.

Additional context Any ideas to work around that problem?

Thank you

closed time in 3 days

denis-ev

issue commentvapor/vapor

Possibility to set static TimeZone or ignore TimeZone

thanks to @0xTim got it working by looking at the default DateFormatter link

denis-ev

comment created time in 3 days

issue commentvapor/vapor

Possibility to set static TimeZone or ignore TimeZone

@denis-ev Just don't tell Leaf to format the date string, format it yourself with DateFormatter, then pass it to Leaf.

Hey @mkll, Then I have to modify a model which would be a bit more of a hassle.

@0xTim gave the tip about creating a custom DateFormatter.

So I'm trying to set a custom leaf tag. I'm checking out the Example, but I'm not sure how to pass the date to it.

denis-ev

comment created time in 3 days

issue commentvapor/vapor

Possibility to set static TimeZone or ignore TimeZone

@denis-ev Just don't tell Leaf to format the date string, format it yourself with DateFormatter, then pass it to Leaf.

denis-ev

comment created time in 3 days

issue openedvapor/vapor

Possibility to set static TimeZone or ignore TimeZone

Is your feature request related to a problem? Please describe. I'm try to set up a website with Events, for which the TimeZone of the Date does not matter. Right now, viewing from different timezones always shows different times.

Describe the solution you'd like Setting the date via #date(date, "YYYY-mm-dd HH:mm", static) or #date(date, "YYYY-mm-dd HH:mm", TimeZone: 0) or similar

Describe alternatives you've considered I've tried to edit the Date on the Server before showing it on the website, but could not get it to work. I have an Event Model which gets passed as the model or even a model array.

Additional context Any ideas to work around that problem?

Thank you

created time in 3 days

issue openedvapor/multipart-kit

Unable to decode nested `[multipartPart]`.

<!-- 🚀 Thank you for contributing! --->

Describe the bug

struct Payload: Content {
    struct NestedPayload: Content {
        let name: String
        let age: Int
    }
    let nestedPayload: [NestedPayload]
}

let encoder = FormDataEncoder()
let encoded = try encoder.encode(Payload(nestedPayload: [.init(name: "abc", age: 10),
                                                         .init(name: "def", age: 20)]),
                                 boundary: "-")
let decoder = FormDataDecoder()
let decoded = try decoder.decode(Payload.self, from: encoded, boundary: "-")

got output [ WARNING ] Value required for key 'nestedPayload.0.age'.

Environment

<!-- We must know your exact environment or it is very difficult to help. --> <!-- Hint: use vapor --version in the root directory of your Vapor project. -->

  • Vapor Framework version: 4.27.0
  • Multipart-Kit Framework version: 4.2.1
  • Vapor Toolbox version: 18.3.3
  • OS version: Mac OS 11.3

created time in 4 days