Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# GitHub Copilot Instructions

## Use Agent Context

When working on this project, consult the `agents.md` file for project-specific guidelines, architecture decisions, and development patterns. This file contains curated information that will help you make better decisions aligned with the project's goals and standards.

If the file does not exist, you will need to install it, by running the following command:

```bash
$ bundle install
$ bundle exec bake agent:context:install
```

This command will set up the necessary context files that help you understand the project structure, dependencies, and conventions.

## Ignoring Files

The `.gitignore` file is split into two sections, separated by a blank line. The first section is automatically generated, while the second section is user controlled.

While working on pull requests, you should not add unrelated changes to the `.gitignore` file as part of the pull request.
3 changes: 1 addition & 2 deletions .github/workflows/documentation-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm
COVERAGE: PartialSummary

jobs:
Expand All @@ -17,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
ruby-version: ruby
bundler-cache: true

- name: Validate coverage
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ concurrency:
cancel-in-progress: true

env:
CONSOLE_OUTPUT: XTerm
BUNDLE_WITH: maintenance

jobs:
Expand All @@ -29,7 +28,7 @@ jobs:

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
ruby-version: ruby
bundler-cache: true

- name: Installing packages
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/rubocop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on: [push, pull_request]
permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm

jobs:
check:
runs-on: ubuntu-latest
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm
COVERAGE: PartialSummary

jobs:
Expand All @@ -21,7 +20,7 @@ jobs:
- macos

ruby:
- "3.4"
- ruby

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -49,7 +48,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
ruby-version: ruby
bundler-cache: true

- uses: actions/download-artifact@v4
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test-external.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on: [push, pull_request]
permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm

jobs:
test:
name: ${{matrix.ruby}} on ${{matrix.os}}
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ on: [push, pull_request]
permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm
TRACES_BACKEND: traces/backend/test
METRICS_BACKEND: metrics/backend/test

jobs:
test:
name: ${{matrix.ruby}} on ${{matrix.os}} ${{matrix.gemfile}}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/agents.md
/.context
/.bundle
/pkg
/gems.locked
Expand Down
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
plugins:
- rubocop-md
- rubocop-socketry

AllCops:
DisabledByDefault: true

Layout/ConsistentBlankLineIndentation:
Enabled: true

Layout/IndentationStyle:
Enabled: true
EnforcedStyle: tabs
Expand Down
2 changes: 2 additions & 0 deletions config/sus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
include Covered::Sus

ENV["CONSOLE_LEVEL"] ||= "warn"
ENV["TRACES_BACKEND"] ||= "traces/backend/test"
ENV["METRICS_BACKEND"] ||= "metrics/backend/test"
2 changes: 1 addition & 1 deletion examples/beer/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ run lambda {|env|
body.write("<!DOCTYPE html><html><head><title>#{count} Bottles of Beer</title></head><body>")

task.async do |task|
begin
task.defer_stop do
body.write(COMMENT)

count.downto(1) do |i|
Expand Down
5 changes: 4 additions & 1 deletion examples/beer/falcon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

service "beer.localhost" do
include Falcon::Environment::Rack
include Falcon::Environment::SelfSignedTLS
# include Falcon::Environment::SelfSignedTLS

count 1
endpoint{Async::HTTP::Endpoint.parse("http://localhost:9293")}
end

service "supervisor" do
Expand Down
6 changes: 3 additions & 3 deletions examples/benchmark/bake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ def compare
threads.times do |n|
c = (n*n).to_s
puts "Running #{command.first} with #{c} concurrent connections..."

Async::Process.spawn("curl", "-o", "/dev/null", "#{host}#{@request_path}")

# Async::Process.spawn("ab", "-k", "-n", "1000", "#{host}#{@request_path}")

Async::Process.spawn("wrk", "-c", c.to_s, "-t", (n).to_s, "-d", "10", "#{host}#{@request_path}")
end
ensure
Expand Down
2 changes: 1 addition & 1 deletion examples/echo/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class EchoBody
def initialize(input)
@input = input
end

def each(&output)
while chunk = @input.read(1024)
output.call(chunk)
Expand Down
4 changes: 2 additions & 2 deletions examples/limited/limited.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def acquire
Console.debug(self, "Acquiring semaphore...")
@queue.pop
Console.debug(self, "Acquired semaphore...")

return Token.new(self)
end

Expand Down Expand Up @@ -67,7 +67,7 @@ def wait_for_inbound_connection(server)
# Wait until there is a connection ready to be accepted:
while true
server.wait_readable

# Acquire the semaphore:
if token = semaphore.acquire
return token
Expand Down
8 changes: 8 additions & 0 deletions examples/service/config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env falcon --verbose serve -c
# frozen_string_literal: true

run do |env|
# To test the fiber profiler, you can uncomment the following line:
# Fiber.blocking{sleep 0.1}
[200, {}, ["Hello World"]]
end
38 changes: 38 additions & 0 deletions examples/service/falcon.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env falcon-host
# frozen_string_literal: true

require "falcon/environment/rack"
require "async/redis"

service "localhost" do
include Falcon::Environment::Rack
endpoint {Async::HTTP::Endpoint.parse("http://0.0.0.0:8013")}
end

class MyService < Async::Service::Generic
def setup(container)
container.spawn do |instance|
evaluator = @environment.evaluator
Console.info(self, "Connecting to Redis at", evaluator.redis_endpoint)

Async do
client = Async::Redis::Client.new(evaluator.redis_endpoint)

instance.ready!

client.subscribe "status" do |context|
Console.info(self, "Subscribed to Redis channel 'status'.")
while response = context.listen
Console.info(self, "Received event:", response)
end
end
end
end
end
end

service "myservice" do
service_class MyService

redis_endpoint {Async::Redis::Endpoint.local}
end
98 changes: 98 additions & 0 deletions examples/service/gems.locked
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
GEM
remote: https://rubygems.org/
specs:
async (2.27.2)
console (~> 1.29)
fiber-annotation
io-event (~> 1.11)
metrics (~> 0.12)
traces (~> 0.15)
async-container (0.25.0)
async (~> 2.22)
async-container-supervisor (0.5.2)
async-container (~> 0.22)
async-service
io-endpoint
io-stream
memory-leak (~> 0.5)
async-http (0.90.1)
async (>= 2.10.2)
async-pool (~> 0.11)
io-endpoint (~> 0.14)
io-stream (~> 0.6)
metrics (~> 0.12)
protocol-http (~> 0.49)
protocol-http1 (~> 0.30)
protocol-http2 (~> 0.22)
traces (~> 0.10)
async-http-cache (0.4.5)
async-http (~> 0.56)
async-pool (0.11.0)
async (>= 2.0)
async-redis (0.12.0)
async (~> 2.10)
async-pool (~> 0.2)
io-endpoint (~> 0.10)
io-stream (~> 0.4)
protocol-redis (~> 0.11)
async-service (0.13.0)
async
async-container (~> 0.16)
console (1.33.0)
fiber-annotation
fiber-local (~> 1.1)
json
falcon (0.52.3)
async
async-container (~> 0.20)
async-container-supervisor (~> 0.5.0)
async-http (~> 0.75)
async-http-cache (~> 0.4)
async-service (~> 0.10)
bundler
localhost (~> 1.1)
openssl (~> 3.0)
protocol-http (~> 0.31)
protocol-rack (~> 0.7)
samovar (~> 2.3)
fiber-annotation (0.2.0)
fiber-local (1.1.0)
fiber-storage
fiber-storage (1.0.1)
io-endpoint (0.15.2)
io-event (1.12.1)
io-stream (0.10.0)
json (2.13.2)
localhost (1.6.0)
mapping (1.1.3)
memory-leak (0.5.2)
metrics (0.13.0)
openssl (3.3.0)
protocol-hpack (1.5.1)
protocol-http (0.51.1)
protocol-http1 (0.34.1)
protocol-http (~> 0.22)
protocol-http2 (0.22.1)
protocol-hpack (~> 1.4)
protocol-http (~> 0.47)
protocol-rack (0.16.0)
io-stream (>= 0.10)
protocol-http (~> 0.43)
rack (>= 1.0)
protocol-redis (0.12.0)
rack (3.2.3)
samovar (2.3.0)
console (~> 1.0)
mapping (~> 1.0)
traces (0.16.2)

PLATFORMS
arm64-darwin-24
ruby

DEPENDENCIES
async-redis
falcon

BUNDLED WITH
2.6.9
6 changes: 6 additions & 0 deletions examples/service/gems.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem "falcon"
gem "async-redis"
8 changes: 4 additions & 4 deletions examples/streaming_upload/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ require "securerandom"

class BodyHandler
attr_reader :time, :md5, :size, :uuid

def initialize(input, length)
@uuid = SecureRandom.uuid
@input = input
@length = length
end

def receive
start = Time.now
@md5 = Digest::MD5.new
@size = 0
@done = false

until @done
begin
chunk = @input.read(1024*1024) # read will raise EOF so we have to check
Expand All @@ -36,7 +36,7 @@ class BodyHandler
@done = true if @length == @size
end
end

@time = Time.now - start
end
end
Expand Down
Loading
Loading