A .NET 8 solution with an intentional race condition for you to analyze and fix.
This is a 3-5 hour technical assessment with two main components.
💡 IMPORTANT: We care more about how you think about the problem and your solution design than the implementation itself. We want to see your analytical process, how you evaluate trade-offs, and how you communicate your design decisions.
Complete the TECHNICAL_ANALYSIS.md document with your in-depth analysis of the race condition problem and proposed solutions.
Implement one of your proposed solutions to fix the race condition in JourneyService.UpdateSegmentStatusAsync().
1. Fork this repository to your own GitHub account:
- Click the "Fork" button at the top right of this repository
- Clone your forked repository to your local machine:
git clone https://github.com/YOUR_USERNAME/FlyrTechnicalTest.git
cd FlyrTechnicalTest2. Read the full challenge details: See RACE_CONDITION_CHALLENGE.md for the complete problem description.
2. Start Redis:
docker run -d -p 6379:6379 --name redis-flyrtech redis:latest3. Verify the problem exists:
dotnet test --filter "FullyQualifiedName~UpdateSegmentStatus_With20ConcurrentUpdates"Expected: ❌ TEST FAILS - Updates are lost due to race condition
4. Complete your technical analysis:
Fill out TECHNICAL_ANALYSIS.md with your analysis and proposed solutions.
5. Implement your solution: Fix the code to make all tests pass.
6. Verify your solution works:
dotnet testExpected: ✅ ALL 23 tests pass
7. Commit and push your changes:
git add .
git commit -m "Fix race condition in JourneyService"
git push origin mainSubmit your work by sending us the link to your forked repository.
Your repository should include:
- TECHNICAL_ANALYSIS.md - Completed with your detailed analysis
- Code changes - Your implementation to fix the race condition
- All tests passing - Including the concurrent updates test
- Clean commit history - Well-organized commits with clear messages
FlyrTech/
├── FlyrTech.Core/ # Domain layer
│ ├── ICacheService.cs # Cache interface
│ ├── IJourneyService.cs # Journey interface
│ └── Models/Journey.cs # Domain model
├── FlyrTech.Infrastructure/ # Infrastructure
│ ├── RedisCacheService.cs # Redis implementation
│ └── JourneyService.cs # ⚠️ Has race condition
├── FlyrTech.Api/ # Web API
│ ├── Program.cs # DI & initialization
│ └── Data/journeys.json # Sample data
└── FlyrTech.Tests/ # Tests
└── JourneyRaceConditionTests.cs # Demonstrates problem
- .NET 8 SDK - Download
- Redis - See installation below
# Install Docker Desktop: https://www.docker.com/products/docker-desktop
docker run -d -p 6379:6379 --name redis-flyrtech redis:latest
# Verify
docker ps
redis-cli ping # Should respond: PONGwsl --install
# Inside WSL:
sudo apt update && sudo apt install redis-server
sudo service redis-server start
redis-cli pingbrew install redis
brew services start redis
redis-cli pingsudo apt update && sudo apt install redis-server
sudo systemctl start redis-server
redis-cli pingBuild:
dotnet build FlyrTech.slnRun Tests:
dotnet test FlyrTech.Tests/FlyrTech.Tests.csprojExpected Results:
- ✅ 22 tests pass
- ❌ 1 test fails (race condition demo)
Run API:
cd FlyrTech.Api
dotnet run- Swagger UI:
https://localhost:5001/swagger - On startup, loads 3 journeys into cache
GET /api/journeys - List all journey IDs
GET /api/journeys/{id} - Get journey details
PUT /api/journeys/{id}/segments/{segmentId}/status - Update segment (
{ "status": "Departed" }PUT /api/journeys/{id}/status - Update journey status
{ "status": "InProgress" }GET /api/cache/demo - Demo endpoint with 60s TTL
GET /api/cache/{key} - Get value
POST /api/cache/{key} - Set value
DELETE /api/cache/{key} - Remove value
All tests require running Redis on localhost:6379.
Test Categories:
- RedisCacheServiceTests (21 tests) - Cache operations
- CacheEndpointTests (1 test) - API behavior
- JourneyRaceConditionTests (2 tests):
- ❌
UpdateSegmentStatus_With20ConcurrentUpdates- FAILS (intentional) - ✅
UpdateSegmentStatus_SequentialUpdates- PASSES
- ❌
FlyrTech.Api/appsettings.json:
{
"Redis": {
"ConnectionString": "localhost:6379"
}
}For remote Redis:
{
"Redis": {
"ConnectionString": "host:port,password=secret"
}
}Clean Architecture with DI:
ICacheService→RedisCacheService(Singleton)IJourneyService→JourneyService(Singleton)IConnectionMultiplexer→ Redis connection pool (Singleton)
Data Flow:
- API starts → Loads
Data/journeys.json - Initializes Redis cache with 3 journeys
- Endpoints use
IJourneyService - Service uses
ICacheService(Redis)
Redis Connection Error:
RedisConnectionException: It was not possible to connect...
Solutions:
- Check Redis is running:
redis-cli ping→ PONG - Check port:
netstat -an | findstr "6379"(Windows) orgrep 6379(Unix) - Docker status:
docker psanddocker logs redis-flyrtech - Clear data:
redis-cli FLUSHALL
Tests Failing Unexpectedly:
- Ensure Redis is running
- Clear Redis:
redis-cli FLUSHALL - Restart Redis service
- Check logs
- RACE_CONDITION_CHALLENGE.md - Detailed problem description and success criteria
- TECHNICAL_ANALYSIS.md - Template for your technical analysis (to be completed)
✅ Real Redis integration (not mocked)
✅ Race condition demonstration for learning
✅ Clean architecture & DI
✅ Journey data auto-initialization
✅ 23 tests (22 pass, 1 intentional fail before fix)
✅ Swagger documentation
✅ Async/await patterns
MIT