MCPcopy Index your code
hub / github.com/bitleak/lmstfy

github.com/bitleak/lmstfy @v1.0.16

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.16 ↗ · + Follow
456 symbols 2,194 edges 61 files 119 documented · 26%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

lmstfy_logo

LMSTFY(Let Me Schedule Task For You)

Build Status Go Report Card codecov GitHub release GitHub release date LICENSE GoDoc

lmstfy(pronounce /'lam.si.fai/) is a simple task queue (or job queue) service based on the Redis storage, providing the following features:

  • basic job queue primitives: PUBLISH, CONSUME and DELETE via HTTP API
  • support extra lifecycle management of jobs:
    • job TTL (time-to-live)
    • job delay trigger (at second granularity)
    • job auto-retry
    • dead letter
  • namespace/queue level metrics
  • token consume/produce rate limit

lmstfy itself doesn't handle data storage, it delegates the storage to the Redis or Redis Sentinel currently (a file based storage backend is under implementing). So data integrity and durability is in the hand of redis, we use AOF and replication on our production env to ensure that.

Playing with Lmstfy

If you just want to have a try, the docker-compose was highly recommended but DON'T use it in production. We would use docker-compose to setup and play with Lmstfy.

  • Running the Redis and Lmstfy server
# run the lmstfy and redis, server would listen on localhost:7777
# and admin port on localhost:7778.

% cd docker && docker-compose -p test-lmstfy up -d
  • Create a new namespace and token
% curl -XPOST -d "description=test namesapce" "http://127.0.0.1:7778/token/test-ns" 
  • Publish a new message
# The queue would be dynamic created, so feel free to publish the message to any queues.
# Below http request would create a job with delay = 1s, ttl = 3600s and tries = 16.

% curl -XPUT -H "X-token:{ENTER YOUR TOKEN}" "http://127.0.0.1:7777/api/test-ns/test-queue?delay=1&ttl=3600&tries=16" 
  • Consume a job from the queue
% curl -H "X-token:{ENTER YOUR TOKEN}" "http://127.0.0.1:7777/api/test-ns/test-queue?ttr=30&timeout=2" 
  • ACK the job
% curl -i -XDELETE -H "X-token:{ENTER YOUR TOKEN}" "http://127.0.0.1:7777/api/test-ns/test-queue/job/{YOUR JOB ID}" 

Building Lmstfy

It is as simple as:

% make

The application binary would be generated at _build dir, you can run it on the Running Lmstfy section.

Running Lmstfy

You must setup the Redis first and configure it in the lmstfy config file before running:

_build/lmstfy-server -c config/demo-conf.toml

Internal

Detailed internal implementation looks like:

lmstfy internal

Client drivers

Documentation

License

LMSTFY is under the MIT license. See the LICENSE file for details.

Extension points exported contracts — how you extend this code

SizeProvider (Interface)
(no doc) [5 implementers]
engine/redis/metrics.go
Engine (Interface)
(no doc) [2 implementers]
engine/engine.go
Job (Interface)
(no doc) [1 implementers]
engine/job.go

Core symbols most depended-on inside this repo

Error
called by 124
client/errors.go
Add
called by 83
engine/redis/pool.go
ID
called by 62
engine/job.go
New
called by 52
auth/token.go
NewJob
called by 52
engine/job.go
Get
called by 44
engine/redis/pool.go
GetTokenManager
called by 35
auth/token.go
NewLmstfyClient
called by 26
client/client.go

Shape

Function 258
Method 163
Struct 30
Interface 3
TypeAlias 2

Languages

Go100%

Modules by API surface

client/client.go46 symbols
client/client_test.go28 symbols
engine/job.go24 symbols
server/handlers/queue_test.go19 symbols
throttler/throttler.go18 symbols
engine/redis/engine.go17 symbols
engine/redis/queue.go16 symbols
server/handlers/admin.go15 symbols
engine/redis/metrics.go15 symbols
engine/migration/engine.go15 symbols
engine/engine.go14 symbols
server/handlers/queue.go13 symbols

For agents

$ claude mcp add lmstfy \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page